Can't open resources from jar when starting with double click

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.

+3
source share
1 answer

Class-Path ? : ( jEdit jExt ) .

.

0

All Articles