facebook

.ClassNotFoundException, don’t find a solution

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #309282 Reply

    schlork
    Member

    I 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 get

    
    Exception 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 GA

    What 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?)

    #309288 Reply

    schlork
    Member

    Uh, 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.

    #309318 Reply

    support-joy
    Member

    schlork,

    Good to hear you are all set 🙂
    Thanks for sharing your findings here. This will help other forum users.

    Best.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: .ClassNotFoundException, don’t find a solution

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in