Jre/lib/rt.jar does not exist - But I have it installed


I try to run a game I had made, but it won’t start.

hp@hp-HP-Z400-Workstation:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib$ echo $JAVA_HOME
hp@hp-HP-Z400-Workstation:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib$ ls
accessibility.properties           images                meta-index
amd64                              jar.binfmt            net.properties
calendars.properties               javafx.properties     psfontj2d.properties
charsets.jar                       jce.jar               psfont.properties.ja
classlist                          jexec                 resources.jar
cmm                                jfxswt.jar            rt.jar
content-types.properties           jsse.jar              security
currency.data                      jvm.hprof.txt         sound.properties
ext                                logging.properties    swing.properties
flavormap.properties               management            tzdb.dat
hijrah-config-umalqura.properties  management-agent.jar

hp@hp-HP-Z400-Workstation:~/Dokumenter/jMonkey/CarGame2/dist/MyGame$ ./MyGame
$JAVA_HOME is set but $JAVA_HOME/jre/lib/rt.jar does not exist. Look elsewhere.
Failed to find system runtime.
hp@hp-HP-Z400-Workstation:~/Dokumenter/jMonkey/CarGame2/dist/MyGame$ java --version
openjdk 10.0.1 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode)

It says it mssing jre/lib/rt.jar, but when I check, it exist. How can I solve this?

I’d first try to bypass that Launcher and see if I can get it to work using the usual java -jar MyGame.jar (but you may still need the ugly -cp stuff).

Apart from that there is only one reason why something can’t find a file: Permissions. But even then I don’t know how you could ls them (maybe you can see the folder lib but can’t cat the .jar?)

Or the Launcher sucks in some way.
You can also try which java to see if you have multiple installs or something


I don’t know how to add this feature inside my jar.

hp@hp-HP-Z400-Workstation:~/Dokumenter/jMonkey/CarGame2/dist/MyGame/app$ java -jar MyGame.jar
aug. 06, 2018 6:34:03 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.2-stable
 * Branch: HEAD
 * Git Hash: f85624a
 * Build Date: 2018-04-17
Exception in thread "main" java.lang.UnsatisfiedLinkError: The required native library 'bulletjme' was not found in the classpath via 'native/linux/x86_64/libbulletjme.so'. Error message: no bulletjme in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
	at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:596)
	at com.jme3.system.JmeDesktopSystem.initialize(JmeDesktopSystem.java:348)
	at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:271)
	at com.jme3.system.JmeSystem.newContext(JmeSystem.java:162)
	at com.jme3.app.LegacyApplication.start(LegacyApplication.java:461)
	at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
	at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
	at mygame.Main.main(Main.java:44)

I would look into the file MyGame to see what it passes to the command line and/or in ant or wherever you created the project.

Just to clarify, you could run the project in your IDE, right? This Process is more of a deploy thing

Yes. I can run the project inside the IDE. But not outside.

The file MyGame gives the result:

hp@hp-HP-Z400-Workstation:~/Dokumenter/jMonkey/CarGame2/dist/MyGame$ ./MyGame
$JAVA_HOME is set but $JAVA_HOME/jre/lib/rt.jar does not exist. Look elsewhere.
Failed to find system runtime.
Failed to launch JVM

I mean what’s the code of MyGame, somewhere it should also only run java -jar like the above somehow.
Or see what your IDE actually runs

Now it’s working. I thougth it was the jar file inside the .zip files.

But it was another jar file inside the dist folder.