Error trying to run headless BehaviorSpace - java

I feel I must apologize for such a basic question, but I am getting an error simply trying to run BehaviorSpace experiments in headless mode. I tried running my own model experiments from the command line, but got an error. So I then tried following the exact instructions on the BehaviorSpace documentation. To do this, I created a BehaviorSpace experiment in the Fire.nlogo model called "experiment1" (see screen shot) and then tried to execute commands to run experiment1 from the command line. The screen shot of the terminal shows that I first set the directory where I have NetLogo 5.3 installed, and then tried to run the commands from the BehaviorSpace documentation. The screen shot of the terminal also shows the Java error I am getting. I have never used the terminal before and am not sure what I am doing wrong, but I am sure I am missing something simple.
I am using Mac OS X and NetLogo 5.3. Thank you for your time.

Seems you're not working in the correct directory.
You need to cd into the netlogo directory:
For me:
netlogo_directory = "/Applications/NetLogo 5.2"
so
cd /Applications/NetLogo\ 5.2
Then you can execute your command:
java -Xmx2048m -Dfile.encoding=UTF-8 -cp ./Netlogo.jar org.nlogo.headless.Main --model /path/to/your/file/name/filename.nlogo --experiment experimentname --table /path/to/log/with/filename.csv --spreadsheet /path/tp/spreadsheet/with/filename.csv

The problem is that the Java file that comes with NetLogo is where the .jar file and lib file are located. Hence, a simple addition of Java/ in the below code allows all files to be found.
java -Xmx1024m -Dfile.encoding=UTF-8 -cp Java/NetLogo.jar \
org.nlogo.headless.Main \
--model Fire.nlogo \
--experiment experiment1 \
--table mytable.csv

Related

java app built with gradle does not start on macOs Monterey

I'm having troubles with an application written in Java and built with gradle on Monterey.
I can build it and make a package to install it on macOS. After the installation I can see the right Icon in the Applications folder, but everytime I try to run it this dialog come out:
I think I tried everything to make it work on this OS.
On every other version of MacOS it works well.
I thought the problem could be regarding some permission, so I allowed permissions to every application like this:
but it still doesn't work.
Tried to run it via Terminal but I'm having this error:
The application cannot be opened for an unexpected reason, error=Error
Domain=NSOSStatusErrorDomain Code=-10810 "kLSUnknownErr: Unexpected internal error"
UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2732,
NSUnderlyingError=0x600000d3ecd0 {Error Domain=RBSRequestErrorDomain Code=5 "Launch
failed." UserInfo={NSLocalizedFailureReason=Launch failed.,
NSUnderlyingError=0x600000d3e520 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or
directory" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}}}
and I didn't find a solution for this.
I thought it could be a problem of signature of the application or something like that, but trying with these commands in a Teminal to find a solution of any type it still doesn't run.
codesign -v "MyApp.app"
codesign -s "MyCompany" MyApp.app
sudo xattr -r -d com.apple.quarantine MyApp.app
sudo chmod -R 755 MyApp.app
sudo codesign --force --deep --sign - MyApp.app
sudo xattr -d -r com.apple.quarantine /Applications/MyApp.app
Nothing happened and I'm at the starting situation of not working app on Monterey.
It's not a problem of Intel or M1 chip.
What could be the solution to this problem?
I searched all internet but didn't find a solution for this.
Thank you for the help.

Why does spark-submit fail with “Error executing Jupyter command”?

When trying to run Spark locally on my Mac (which used to work) ...
/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/bin/java \
-cp /usr/local/Cellar/apache-spark/2.4.0/libexec/conf/:/usr/local/Cellar/apache-spark/2.4.0/libexec/jars/* \
-Xmx1g org.apache.spark.deploy.SparkSubmit \
--packages org.mongodb.spark:mongo-spark-connector_2.11:2.4.0 \
/Users/crump/main.py
I'm now getting the following error:
Error executing Jupyter command '/Users/crump/main.py': [Errno 2] No such file or directory
The file is there. Since I know this used to work, I must have installed something recently that changed a library, sdk, etc.
Ok, I found the answer finally: PYSPARK_DRIVER_PYTHON=jupyter in my environment. I set this up to launch Jupyter/Spark notebooks with just the pyspark command, but it causes spark-submit to fail.
The solution is set the variable to use python, not jupyter: PYSPARK_DRIVER_PYTHON=python.

jmeter plugins cmd runner

I am running the the following:
java -jar /opt/jmeter/apache-jmeter-2.13/lib/ext/CMDRunner.jar \
--tool Reporter --generate-png /home/nune/jmeter_test/target/jmeter/results/RTOT.png \
--input-jtl A.jtl --plugin-type ResponseTimesOverTime
command from the terminal.PNG file is successfully creating but the process is not ending.
How can I resolve this issue. I want to end process after picture is successfully created.
I suspect the image is still being generated possibly due to lack of memory, in this case add after java
-Xmx256m
An other option is head issues, then add after java
-Djava.awt.headless=true
If none of those work, run on the pid of process:
jstack -l pid
and show output here

Compile a java file using docker with own path

Hy. I'm trying to compile a .java file using docker. I read the files on docker's website, also I read these links:
docker's website
about volumes
and another question I had put up for gcc compiler
I understood the concept for the gcc compiler since it doesn't create any extra file for compiling.
But the java one does. It creates a Main.class file on my /home directory if I use the following command and compile a file named Main.java
sudo docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp java:7 javac Main.java
after learning from the above links I was able to successfully compile a java file with my own path using:
docker run --rm -v /mypathhere/mycode.java:/mycode.java: java:7 javac mycode.java"
if there is any error it shows an error but if there isn't it just compiles and gives me no output, and that's justified because it creates a Main.class file.
My problem is that I am unable to find that Main.class file. I don't know where docker is creating it and I have zero understanding for it. Please help me out.
The .class file will be inside the container, under the root directory.
The best plan is to mount the whole source directory and have javac put the result to the same directory e.g:
docker run --rm -v /mypathhere:/mycode java:7 sh -c "cd mycode; javac mycode.java"
That way, you should get the class file written to the mypathhere directory.
Apologies if that doesn't quite work - it's off the top of my head. Hopefully you get the idea though.

How do you get WordCount.java to compile on Cloudera 4?

I'm trying to compile a simple WordCount.java map-reduce example on a linux (CentOS) installation of Cloudera 4. I keep hitting compiler errors when I reference any of the hadoop classes, but I can't figure out which jars of the hundreds under /usr/lib/hadoop I need to add to my classpath to get things to compile. Any help would be greatly appreciated! What I'd like most is a java file for word count (just in case the one I found is bad for some reason) along with the associated command to compile and run it.
I am trying to do this using just javac rather than Eclipse. My main issue either way is what exactly are the Hadoop libraries from the Cloudera 4 install which I need to include in order to get the classic WordCount example to compile. Basically, I need to put the Java MapReduce API classes (Mapper, Reducer, etc.) in my classpath.
I have a script that builds my hadoop classes. Try:
#!/bin/bash
program=`echo $1 | awk -F "." '{print $1}'`
if [ ! -d "${program}_classes" ]
then mkdir ${program}_classes/;
fi
javac -classpath /usr/lib/hadoop/hadoop-common-2.0.0-cdh4.0.1.jar:/usr/lib/hadoop/client/h\
adoop-mapreduce-client-core-2.0.0-cdh4.0.1.jar -d ${program}_classes/ $1
jar -cvf ${program}.jar -C ${program}_classes/ .;
You were probably missing the key jars:
/usr/lib/hadoop/hadoop-common-2.0.0-cdh4.0.1.jar
and
/usr/lib/hadoop/client/hadoop-mapreduce-client-core-2.0.0-cdh4.0.1.jar
If you are running the Cloudera CDH4 Virtual Machine then the following should get you running:
javac -classpath /usr/lib/hadoop/hadoop-common-2.0.0-cdh4.0.0.jar:/usr/lib/hadoop/client/hadoop-mapreduce-client-core-2.0.0-cdh4.0.0.jar -d wordcount_classes WordCount.java
Or you can export environment:
export JAVA_HOME=/usr/java/default
export PATH=${JAVA_HOME}/bin:${PATH}
export HADOOP_CLASSPATH=${JAVA_HOME}/lib/tools.jar
and use the commands below:
$ bin/hadoop com.sun.tools.javac.Main WordCount.java
$ jar cf wc.jar WordCount*.class
If you are using Eclipse please do add Hadoop packages. you may get it from java2s or any similar sites. I couldn't say without know anything about what you did till now.

Categories

Resources