Closed jnweiger closed 11 months ago
sudo apt-get install openjdk-{11,17,18}-{jdk,jre}
and playing with update-alternatives --config java
Result: -> same crash with openjdk 17,18,19, -> visicut works fine with openjdk 11
Please try the java options listed here for a first diagnosis: https://luppeng.wordpress.com/2023/04/01/use-openjdk-19-to-build-and-run-apache-atlas-v2-3-0/
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED -Djdk.reflect.useDirectMethodHandle=false
There the error message is similar to ours.
@mgmax thanks for the hint!
Workaround:
...
# --add-opens ... and --Djdk.reflect... options are needed for openjdk-19 compatibility
java --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED -Djdk.reflect.useDirectMethodHandle=false -Xms256m -Xmx1024m -jar "$DIR/Visicut.jar" "$@"
Good to see that we have a work-around. I'm not sure why it broke, as we already apply a bunch of these "opens" settings in the pom.xml file. Visicut definitely worked with JDK17 at some point, I spent quite some time to make it work initially. As far as I remember, our Windows and Mac versions also ship a bundled JDK that is version 17 or similar.
Please try to move all the "opens" stuff to the pom.xml file (just search for "opens" in the file). Everything there gets applied to all platforms and not just Linux.
Then please try if the -D ... option is really needed. If yes then it probably needs to be added in three places - Linux, Mac and Windows Launcher.
Can you please double-check if it is really broken with Java 17? Your commandline output in the issue report looks like from an older version. The latest VisiCut searches for the correct Java version and warns if it cannot find Java 11 or 17. https://github.com/t-oster/VisiCut/commit/540595a1cdf42976efaa1c1b25dcbcdbb7530ff2
VisiCut works fine with the Java bundled in the AppImages, as far as I can tell, which is a prebuilt JVM found in https://github.com/adoptium/temurin17-binaries. I'd consider that the "reference environment" because the AppImage works on a majority of distributions.
The JAR built by distribute.sh
also works (locally) on my workstation with OpenJDK 19. Same goes for https://download.visicut.org/files/master/All/VisiCut-1.9-209-g4df13952.zip. I checked the latter in an Ubuntu 22.04 VM as well. In both cases, I used the provided launch script.
I can't reproduce the issue:
sudo apt install openjdk-19-jre
VISICUT_JAVA=/usr/lib/jvm/java-19-openjdk-amd64/bin/java visicut
--> VisiCut works correctly and uses Java 19.--> Closing as not reproducible.
(Also seen with VisiCut 1.8)
Should I try newer or older versions of Java?