Running JaamSim via API

106 views
Skip to first unread message

Alvaro

unread,
Feb 15, 2025, 6:33:56 AM2/15/25
to JaamSim Users Discussion Group
Hi all,

Is there any example code where I can see how JaamSim simulations are run from the API?
Can you help me troubleshooting my Eclipse configuration?

I am struggling to understand how or even whether a simulation created in the GUI (by opening directly the .jar) can be run with code.

The first thing I wanted to try, was to set up eclipse to run JaamSim from there, but I get the error:

Error: Unable to load main class com.jaamsim.ui.GUIFrame in module JaamSim

Caused by: java.lang.NoClassDefFoundError


I tried removing the project and setting it up at least 4 times, but did not manage to make it work. 


As the error references com.jaamsim.ui.GUIFrame, this is my run configuration where it's linked


Screenshot 2025-02-15 123232.png


Kind regards,

Alvaro


Harvey Harrison

unread,
Feb 20, 2025, 12:51:29 PM2/20/25
to Alvaro, JaamSim Users Discussion Group
Hi Alvaro,

Based on the error message, I'd check to make sure you have added the jaamsim jar as a dependency on the classpath in the dependencies tab, otherwise it is unable to find the class you are referencing at runtime. This should be supported, but is not generally tested on my side, see the programming manual for some assistance in setting up eclipse to run from the jaamsim source code as an alternative.

Please feel free to report back if you have any success or run into further difficulties.

Harvey

--
You received this message because you are subscribed to the Google Groups "JaamSim Users Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jaamsim-user...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/jaamsim-users/2608b907-6e12-4ded-a27d-34b707d994fcn%40googlegroups.com.

Alvaro

unread,
Feb 22, 2025, 8:18:02 AM2/22/25
to JaamSim Users Discussion Group
Hi Harvey,

Thank you for the reply.

I added it to the classpath (instead of class module, as I did previously) and the error seems resolved.

Now, JaamSim launches but it does not show the model view window and throws an exception "Unable to deterimne graphics configuration"

run_error.png

In my desperation, I downgraded to Java 8, but this also throws an exception:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/jaamsim/ui/GUIFrame has been compiled by a more recent version of the Java Runtime

 Any guidance will be highly appreciated.

Regards,
Alvaro 
Reply all
Reply to author
Forward
0 new messages