Running Jar File in Mac
This topic has been viewed 12753 times and has 16 replies
Running Jar File in Mac
Hello,
I have changed the code of Sweethome3d in order to create my own application and I have created an executable jar file. I would like to run it from command line, but for some strange reason it does not.
I use this command in terminal
java -jar Blender.jar -Djava.ext.dirs=lib:lib/macosx
but it gives me this mistake
Exception in thread "main" java.lang.SecurityException: sealing violation: package javax.media.j3d is sealed
at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.eteks.sweethome3d.j3d.Component3DManager.setRenderingErrorObserver(Component3DManager.java:104)
at com.eteks.sweethome3d.SweetHome3D.addComponent3DRenderingErrorObserver(SweetHome3D.java:491)
at com.eteks.sweethome3d.SweetHome3D.init(SweetHome3D.java:383)
at com.eteks.sweethome3d.Blender.main(Blender.java:181)
What I have also done is change the MANIFEST.MF in order to have my main class as the main class of the program. Is that wrong?
Manifest-Version: 1.0
Created-By: 1.5 (Sun Microsystems, Inc)
Main-Class: com.eteks.sweethome3d.Blender
Could you tell me if you have any idea what I am doing wrong?
I have changed the code of Sweethome3d in order to create my own application and I have created an executable jar file. I would like to run it from command line, but for some strange reason it does not.
I use this command in terminal
java -jar Blender.jar -Djava.ext.dirs=lib:lib/macosx
but it gives me this mistake
Exception in thread "main" java.lang.SecurityException: sealing violation: package javax.media.j3d is sealed
at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.eteks.sweethome3d.j3d.Component3DManager.setRenderingErrorObserver(Component3DManager.java:104)
at com.eteks.sweethome3d.SweetHome3D.addComponent3DRenderingErrorObserver(SweetHome3D.java:491)
at com.eteks.sweethome3d.SweetHome3D.init(SweetHome3D.java:383)
at com.eteks.sweethome3d.Blender.main(Blender.java:181)
What I have also done is change the MANIFEST.MF in order to have my main class as the main class of the program. Is that wrong?
Manifest-Version: 1.0
Created-By: 1.5 (Sun Microsystems, Inc)
Main-Class: com.eteks.sweethome3d.Blender
Could you tell me if you have any idea what I am doing wrong?
Re: Running Jar File in Mac
Well, even if I don't change the manifest, it still doesn't run.
Re: Running Jar File in Mac
Even with this: java -jar Blender.jar -vmargs Djava.ext.dirs=lib:lib/macosx
Re: Running Jar File in Mac
In what folder did you run this command?I use this command in terminal
java -jar Blender.jar -Djava.ext.dirs=lib:lib/macosx
Did you try with absolute paths instead of relative paths "lib" and "lib/macox"?
-vmargs isn't a java command option!Even with this: java -jar Blender.jar -vmargs Djava.ext.dirs=lib:lib/macosx
Your problem is due to the fact that the JVM doesn't find the Java 3D libs in the extension folders you specified, so it uses the default old ones in the system found in /System/Library/Java/Extensions/. The easiest way to check this is to temporarily remove the j3d*.jar files from this folder, then when you run again your java command, you'll get a NoClassDefFoundError exception about a Java 3D class.
Emmanuel Puybaret, Sweet Home 3D creator
Re: Running Jar File in Mac
I have placed my Blender.jar file in a folder in my desktop. First I open the folder using the cd command, and then I run the jar file. But it seems not to recognize the VM arguments.
You are right about -vmargs, but I was reading a forum and I got confused. I removed temporarily the jar files from this folder as you said, and I got the message.
Now, I tried to run the SweetHome3D-3.3.jar file and it runs perfectly from command line using the command as before.
I will try with absolute paths, and I will tell you the result.
You are right about -vmargs, but I was reading a forum and I got confused. I removed temporarily the jar files from this folder as you said, and I got the message.
Now, I tried to run the SweetHome3D-3.3.jar file and it runs perfectly from command line using the command as before.
I will try with absolute paths, and I will tell you the result.
Re: Running Jar File in Mac
It even runs without the -Djava.ext.dirs option. [;)]I tried to run the SweetHome3D-3.3.jar file and it runs perfectly from command line using the command as before.
If you want to make your program work as SweetHome3D Jar executable, study how it is built with jarExecutable Ant target.
Emmanuel Puybaret, Sweet Home 3D creator
Re: Running Jar File in Mac
Thanks for the advice.
Re: Running Jar File in Mac
Well, I tried to do it with absolute paths, but no luck. I cannot understand.
Re: Running Jar File in Mac
Well, I used the absolute paths in order to show in the Sweethome3d source code right? lib: /Users/dimitramicha/Documents/workspace/SweetHome3D-3.3-src/lib
and lib/macosx: /Users/dimitramicha/Documents/workspace/SweetHome3D-3.3-src/lib/macosx
which are in the workspace.
Which main should I keep? I kept as run configurations the ones that I use to execute the program right? I really am very confused.
and lib/macosx: /Users/dimitramicha/Documents/workspace/SweetHome3D-3.3-src/lib/macosx
which are in the workspace.
Which main should I keep? I kept as run configurations the ones that I use to execute the program right? I really am very confused.
Re: Running Jar File in Mac
I also try to do it with the existing source code, in order to see if I have some mistakes in my code, but the jar file that I export, does not run.
Who is online
Users browsing this forum: No registered users and 1 guest