- This topic has 2 replies, 2 voices, and was last updated 14 years, 5 months ago by support-joy.
-
AuthorPosts
-
schlorkMemberI try to create a jar file, which is supposed to run with a simple java -jar myjarfile.jar.
That used to work, but since I implemented some windows with swt, it stopped working. I searched the Internet for days now and tried about everything, without success.
I do have a jarfile sappw.jar, which does run via
java.exe -classpath “.\lib\sapjco.jar;.\lib\org.eclipse.swt_3.3.2.v3349d.jar;.\lib\org.eclipse.swt.win32.win32.x86_3.3.3.v3349.jar;.\sappw.jar” joJCO.SAPpw
It contains a manifest file MANIFEST.MF, stating
Manifest-Version: 1.0 Created-By: Fat Jar Eclipse Plug-In Main-Class: joJCO.SAPpw Class-Path: .\lib\sapjco.jar;.\lib\org.eclipse.swt_3.3.2.v3349d.jar;.\lib\org.eclipse.swt.win32.win32.x86_3.3.3.v3349.jar;.\sappw.jar
but that doesn’t seem to help. (I also tried manually building a jar via jar.exe with this Manifest. And yes, there are line feeds in the end.) When I start the jar via
java -jar sappw.jar
I always getException in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Layout Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Layout at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: joJCO.SAPpw. Program will exit.
I tried Eclipse Export, Fatjar, jar.exe by hand – to no avail. I studied jar syntax, Manifest format, tried everything. According to the solutions I found I modified the run configuration (although that works) and specified the Main-Class everywhere where it’s possible, no dice. I cleaned and recompiled, all the same.
– Compiler compliance level is 6
– java is version “Java(TM) SE Runtime Environment (build 1.6.0_18-b07)”
– JRE system library of project is jdk 1.6
– OS is win2k
– Myeclipse is 6.0.1 GAWhat I find irritating is:
– Why is it the widgets Layout that fails fail to find my class (above error message)?Can anybody help me crating a jarfile which knows how to run? (And anyone explain to me why is that so terribly hard?)
schlorkMemberUh, really. A whole day of searching, but no standard example, no help in the jar builder, neither eclipse nor fatjar, no manual told me there have to be spaces as delimiters in the classpath. (Oh, yes, now I found some. When I had spaces there once (because I really tried everything) a different error resulted in the same meaningless error message.) No debug output, no error messge, nothing even remotely pointing in the right direction. Java, I hate you.
You can mark this issue as solved.
support-joyMemberschlork,
Good to hear you are all set 🙂
Thanks for sharing your findings here. This will help other forum users.Best.
-
AuthorPosts