2

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?

bfuda
  • 67
  • 1
  • 7

1 Answers1

3

"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
Bryan Head
  • 12,360
  • 5
  • 32
  • 50
  • Hi @Bryan Head i wish I had the typo in my script, but I have the exact same issue for days and cant get int to run on a cluster, same code and same NetLogo version(NetLogo/5.3.1-64/) on my local dev work fine, but I keep getting Could not find the main class: org.nlogo.headless.main. Program will exit. Any Ideas? – Marzy May 28 '18 at 10:35
  • 1
    @Marzy If that is the error message, then you may accidentally be using different scripts on your local dev vs the cluster. Check the cluster script for the typo. If it's not there, please open a new question. – Bryan Head May 28 '18 at 15:16