Java error when trying to run NetLogo headlessly o

2020-04-19 05:51发布

I am attempting to run Netlogo headlessly using linux in order to send a job to a cluster. I have never used linux before, but I am attempting to follow the directions here (http://netlogo-users.18673.x6.nabble.com/Running-NetLogo-Headless-in-Behaviorspace-Sample-code-td4862232.html).

My script is:

#!/bin/bash
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -c 7
java -Xmx1024m -Dfile.encoding=UTF-8 -cp /opt/shared/netlogo/5.3.1-64/app/NetLogo.jar \
org.nlogo.headless.main \
--model /cluster/home/rfuda01/UM_model.nlogo \
--experiment UM \
--table /cluster/home/rfuda01/UM_test.csv

In the output file, I am receiving the following error message:

Exception in thread "main" java.lang.NoClassDefFoundError: org/nlogo/headless/main
Caused by: java.lang.ClassNotFoundException: org.nlogo.headless.main
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: org.nlogo.headless.main. Program will exit.

Any ideas what this means or how to fix this?

1条回答
该账号已被封号
2楼-- · 2020-04-19 06:46

"main" should be capitalized: "Main". So the script should be:

#!/bin/bash
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -c 7
java -Xmx1024m -Dfile.encoding=UTF-8 -cp /opt/shared/netlogo/5.3.1-64/app/NetLogo.jar \
org.nlogo.headless.Main \
--model /cluster/home/rfuda01/UM_model.nlogo \
--experiment UM \
--table /cluster/home/rfuda01/UM_test.csv
查看更多
登录 后发表回答