Print at Dec 21, 2025, 7:40:46 PM
Posted by Mitsaki at Sep 13, 2011, 6:42:21 PM
confused   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?

Posted by Mitsaki at Sep 13, 2011, 7:02:49 PM
Re: Running Jar File in Mac
Well, even if I don't change the manifest, it still doesn't run.

Posted by Mitsaki at Sep 13, 2011, 8:28:19 PM
Re: Running Jar File in Mac
Even with this: java -jar Blender.jar -vmargs Djava.ext.dirs=lib:lib/macosx

Posted by Puybaret at Sep 14, 2011, 7:44:21 AM
Re: Running Jar File in Mac
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

Posted by Mitsaki at Sep 14, 2011, 10:19:24 AM
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.

Posted by Puybaret at Sep 14, 2011, 12:06:17 PM
Re: Running Jar File in Mac
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. wink
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

Posted by Mitsaki at Sep 14, 2011, 12:14:51 PM
Re: Running Jar File in Mac
Thanks for the advice.

Posted by Mitsaki at Sep 14, 2011, 2:11:01 PM
Re: Running Jar File in Mac
Well, I tried to do it with absolute paths, but no luck. I cannot understand.

Posted by Mitsaki at Sep 14, 2011, 2:37:27 PM
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.

Posted by Mitsaki at Sep 14, 2011, 4:45:34 PM
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.

Posted by Puybaret at Sep 15, 2011, 8:19:21 AM
Re: Running Jar File in Mac
There's no reason your Jar executable shouldn't work, If you try to build it the same way I used for Sweet Home 3D, meaning:
- Use a main class similar to com.eteks.sweethome3d.SweetHome3DBootstrap, where you'll store in applicationClassName variable the name of your own main class, and add to applicationPackages array your own packages if you created some. The class loader used by this special main class extracts all the DLLs and JARs required by the project from the running Jar executable file, and stores them in temporary files referenced during the execution of the application (quickly said it conveniently replaces the java.ext.dirs property).
- Build the Jar executable with a Ant task that gathers project class files, resources files, jar libraries and Java 3D DLLs.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by Mitsaki at Jun 4, 2012, 2:45:43 PM
confused   Re: Running Jar File in Mac
Hello!!

This is a rather old thread, but it is the last remaining step for my thesis! (finally). Actually, my partner in thesis had solved this problem, but we can't remember how we did it.

Following your last advice, we tried to do it by using ant, meaning:

1. Like it is said in the README.txt we did

If you want to build Sweet Home 3D with Ant, please install last JDK 5 or 6 and
Ant available at http://ant.apache.org/, and run ant command in the directory where
you uncompressed this archive.
The default target provided by build.xml Ant file builds the Java Web Start version.
Read build.xml Ant file for more information about other available targets.
Note that the last part of the Ant targets javaWebStart, applet and viewer
requires a passphrase for keystore to sign the deployed jars. For security reasons,
the required file keys.keytool isn't provided with this source code. You'll have
first to generate this file and choose a passphrase, with the following command run
in the directory where you uncompressed this archive:
keytool -genkey -keystore keys.keytool -alias SweetHome3D

2. So I went to workspace/Sweethome3d-src and I entered the above line, where I put my password and some other required stuff.

3. Then, through eclipse, I went to run->external tools-> external tools configuration -> ant build, where I added the vm arguments and I located the build.xml file that was required

4. I run this ant build, where I put the password and the displayed message was "BUILD SUCCESSFUL"

5. Then I tried to export the file as runnable jar using the option "With ant" and I exported it.

6. Finally I tried, by using the terminal, to open my jar file, but no luck...

Please, it is a matter of physical health, right now. I need to fix this! sad crying
Help me!
Mitsaki

Posted by Puybaret at Jun 4, 2012, 5:54:40 PM
Re: Running Jar File in Mac
I don't understand why speak about building the Java Web Start version, in a subject named "Running Jar File in Mac". Did I miss something or did you forget to read again my previous message about jarExecutable Ant target?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by Mitsaki at Jun 4, 2012, 6:39:16 PM
Re: Running Jar File in Mac
I guess that I shouldn't have done steps 1 and 2 in order to do that:
Build the Jar executable with a Ant task that gathers project class files, resources files, jar libraries and Java 3D DLLs.


I should do
If you want to build Sweet Home 3D with Ant, please install last JDK 5 or 6 and
Ant available at http://ant.apache.org/, and run ant command in the directory where
you uncompressed this archive.
right?

I am really confused.

Posted by Puybaret at Jun 5, 2012, 6:48:57 PM
Re: Running Jar File in Mac
Yes steps 1 and 2 are useless to generate an executable file.

In Eclipse, simply check jarExecutable target in the Targets tab of the External Tools Configuration dialog box.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by Mitsaki at Jun 6, 2012, 6:23:24 PM
Re: Running Jar File in Mac
Thank you! That was exactly the problem:)))) Live savior again:)

Posted by heneveld at Aug 26, 2013, 12:44:03 AM
Re: Running Jar File in Mac
I encountered the same "sealing violation" problem when running in the Eclipse IDE via SweetHome3D.main. Building a JAR worked fine but it is nice to be able to skip that step. The post at [1] suggests that the sealing violation error is due to the version of Java3D installed on my system (OS X Mountain Lion). The solution at that post (the installer at [2]) worked for me and I can now run smoothly from the IDE with no special config.

HTH
Alex

[1] http://stackoverflow.com/questions/12787476/how-to-install-java-3d-on-mac

[2] http://create.ife.no/vr/tools/j3d/java3d_1_5_2-macosx.pkg.zip