confused High priority Running Jar File in Mac

This topic has been viewed 12754 times and has 16 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Running Jar File in Mac

Post by Mitsaki »

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?
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Re: Running Jar File in Mac

Post by Mitsaki »

Well, even if I don't change the manifest, it still doesn't run.
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Re: Running Jar File in Mac

Post by Mitsaki »

Even with this: java -jar Blender.jar -vmargs Djava.ext.dirs=lib:lib/macosx
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Running Jar File in Mac

Post by Puybaret »

I use this command in terminal
java -jar Blender.jar -Djava.ext.dirs=lib:lib/macosx
In what folder did you run this command?
Did you try with absolute paths instead of relative paths "lib" and "lib/macox"?
Even with this: java -jar Blender.jar -vmargs Djava.ext.dirs=lib:lib/macosx
-vmargs isn't a java command option!

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
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Re: Running Jar File in Mac

Post by Mitsaki »

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.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Running Jar File in Mac

Post by Puybaret »

I tried to run the SweetHome3D-3.3.jar file and it runs perfectly from command line using the command as before.
It even runs without the -Djava.ext.dirs option. [;)]
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
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Re: Running Jar File in Mac

Post by Mitsaki »

Thanks for the advice.
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Re: Running Jar File in Mac

Post by Mitsaki »

Well, I tried to do it with absolute paths, but no luck. I cannot understand.
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Re: Running Jar File in Mac

Post by Mitsaki »

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.
Mitsaki
Posts: 62
Joined: Tue Jul 26, 2011 2:27 pm

Re: Running Jar File in Mac

Post by Mitsaki »

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.
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest