Repast / repast.simphony

Git repository for Repast Simphony development
repast.github.io
90 stars 21 forks source link

Java 17 JVM Arguments for Batch Mode Runs #86

Closed ncollier closed 3 months ago

ncollier commented 1 year ago

Add the required arguments for Java 17 to prevent IllegalAccess exceptions (e.g. --add-opens /=ALL-UNNAMED) when running in batch mode.

ncollier commented 1 year ago

Problem is NOT with the batch runs themselves but rather with running the ant task that configures and executes the batch run. The xmltask jar that we use in there references unexported modules. Adding this

--add-exports java.xml/com.sun.org.apache.xpath.internal=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xpath.internal.objects=ALL-UNNAMED

to the launcher for the model / batch GUI seems to fix the issue. More testing required to know for sure.

Note --add-opens seems to work as well.

88 also requires new --add-opens:

--add-opens java.base/java.lang.reflect=ALL-UNNAMED
ncollier commented 1 year ago

Adding the above --add-exports to JZombies launch configurations fixes the issue. I'm going to try to contact the original poster and see if this solves it for them. If fix works, then need to add those args to RSProjectConfigurator lines 53 and 56.

jonas-andersen commented 12 months ago

Adding those parameters to the launchers seems to fix the issue. For the distributed model (Builder Installer for ) I also had to add them to the start_model.bat and start_model.command files in the installer directory.

etatara commented 11 months ago

The Eclipse launch configuration for batch runs already includes these VM args (including the one required by #88, if we need that). We need to update the RS runtime launch config to include these via RSProjectConfigurator.VMARGS and .BATCH_VMARGS. We should also update the start_model.bat and start_model.command in the r.s.eclipse/setupfiles/installer.

Apply fix to the following locations:

ncollier commented 3 months ago

Working JVM options for Java 17:

-XX:+IgnoreUnrecognizedVMOptions
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-modules=ALL-SYSTEM
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
--add-exports=java.desktop/sun.awt=ALL-UNNAMED
--add-exports=java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-exports=java.xml/com.sun.org.apache.xpath.internal.objects=ALL-UNNAMED
--add-exports=java.xml/com.sun.org.apache.xpath.internal=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
ncollier commented 3 months ago

vm args formatted for bat and model files:

start_model.bat:

 -XX:+IgnoreUnrecognizedVMOptions --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-modules=ALL-SYSTEM --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-exports=java.desktop/sun.awt=ALL-UNNAMED --add-exports=java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xpath.internal.objects=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xpath.internal=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED

start_model.command:

-XX:+IgnoreUnrecognizedVMOptions \
    --add-opens java.base/java.lang.reflect=ALL-UNNAMED \
    --add-modules=ALL-SYSTEM \
    --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED \
    --add-exports=java.desktop/sun.awt=ALL-UNNAMED \
    --add-exports=java.base/java.lang=ALL-UNNAMED \
    --add-opens java.base/java.util=ALL-UNNAMED \
    --add-exports=java.xml/com.sun.org.apache.xpath.internal.objects=ALL-UNNAMED \
    --add-exports=java.xml/com.sun.org.apache.xpath.internal=ALL-UNNAMED \
    --add-opens java.base/java.lang=ALL-UNNAMED \
ncollier commented 3 months ago

Updated repast simphony: 3cc7df65 Updated models: https://github.com/Repast/repast.simphony.models/commit/fbc9f87538dc1999769282233041fc41f33b0e0e