Take a little Test-Class:
public class Test {
public static void main(String[] args) {
System.out.println("Just a test");
}
}
Compile it:
[rli@rlinux javapackager2]$ javac Test.java
Then create the jar file:
javapackager -createjar -srcdir . -srcfiles Test.class -outdir input -outfile Main.jar -appclass Test
It works:
[rli@rlinux javapackager2]$ java -jar input/Main.jar
Just a test
Then make a bundle:
[rli@rlinux javapackager2]$ javapackager -deploy -srcdir input/ -outdir output -outfile test -native image -BmainJar=Main.jar -appclass Test
No base JDK. Package will use system JRE.
No base JDK. Package will use system JRE.
Creating app bundle: /home/rli/tmp/javapackager2/output/bundles/Test
Looks, good, however:
[rli@rlinux javapackager2]$ output/bundles/Test/Test
Test Class Test not found.
Test Failed to launch JVM
Because:
[rli@rlinux javapackager2]$ ls output/bundles/Test/app/
Test.cfg
There is not a single jar-file in the app-Directory.
Only if -srcfiles Main.jar is added to the command line will the Main.jar be included into the bundle.
However the documentation clearly states:
-srcfiles files
List of files in the directory specified by the -srcdir option. If omitted, all files in the directory (which is a mandatory argument in this case) will be used. Files in the list must be separated by spaces.
So the "omitted" case seems to be not handled properly be the Linux bundler.
The problem also occurs under OSX.
But not so under Windows.
public class Test {
public static void main(String[] args) {
System.out.println("Just a test");
}
}
Compile it:
[rli@rlinux javapackager2]$ javac Test.java
Then create the jar file:
javapackager -createjar -srcdir . -srcfiles Test.class -outdir input -outfile Main.jar -appclass Test
It works:
[rli@rlinux javapackager2]$ java -jar input/Main.jar
Just a test
Then make a bundle:
[rli@rlinux javapackager2]$ javapackager -deploy -srcdir input/ -outdir output -outfile test -native image -BmainJar=Main.jar -appclass Test
No base JDK. Package will use system JRE.
No base JDK. Package will use system JRE.
Creating app bundle: /home/rli/tmp/javapackager2/output/bundles/Test
Looks, good, however:
[rli@rlinux javapackager2]$ output/bundles/Test/Test
Test Class Test not found.
Test Failed to launch JVM
Because:
[rli@rlinux javapackager2]$ ls output/bundles/Test/app/
Test.cfg
There is not a single jar-file in the app-Directory.
Only if -srcfiles Main.jar is added to the command line will the Main.jar be included into the bundle.
However the documentation clearly states:
-srcfiles files
List of files in the directory specified by the -srcdir option. If omitted, all files in the directory (which is a mandatory argument in this case) will be used. Files in the list must be separated by spaces.
So the "omitted" case seems to be not handled properly be the Linux bundler.
The problem also occurs under OSX.
But not so under Windows.