Iβve been struggling with this problem for some time. I found this and this , but these solutions will not work for me at all.
My jar works fine with java -jar on the command line, but when it comes to double-clicking, the JFrame window opens, but it fails:
Scanner fileLat = new Scanner( a.getClass().getResourceAsStream("/motor/resources/lat.txt") );
Scanner fileLong = new Scanner( a.getClass().getResourceAsStream("/motor/resources/long.txt") );
What is the result of exceptions and null pointer resources not found.
My directory structure (inside the jar) is as follows:
/ (root)
|- META-INF
|- motor
|- main
|- Main.class
|- resources
|- lat.txt
|- long.txt
And my MANIFEST.MF reads like this:
Manifest-Version: 1.0
Class-Path: .
Main-Class: motor.main.Main
Edit: I just tried this one (especially the jar: file: MyJar.jar! / Etc ... file), and it didn't work either.
Nirro source
share