jar file executes fine in netbeans file manager but on its own...

Discussion in 'Java' started by Joe Vasher, May 12, 2004.

  1. Joe Vasher

    Joe Vasher Guest

    I wrote a program that uses swing components when I created a jar file
    it compiled and worked fine if you execute it in the netbeans(3.6) file
    system. But when I copy the jar file to my desk top and run that with
    "java -jar Calendar.jar" I get the following errors.

    java.lang.NoClassDefFoundError: javax/swing/JFrame
    at java.lang.ClassLoader.defineClass0 (ClassLoader.java)
    at java.lang.ClassLoader.defineClass (ClassLoader.java:179)
    at java.security.SecureClassLoader.defineClass
    (SecureClassLoader.java:33)
    at kaffe.lang.AppClassLoader$JarSource.findClass
    (AppClassLoader.java:143)
    at kaffe.lang.AppClassLoader.findClass (AppClassLoader.java:291)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:142)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:121)
    at kaffe.jar.ExecJarName.main (ExecJarName.java:55)
    at kaffe.jar.ExecJar.main (ExecJar.java:75)

    THIS IS MY Manifest.

    Manifest-Version: 1.0
    Created-By: NetBeans IDE
    Main-Class: jnj_development.com.view.CalendarView

    I have two files 1 is the JFrame that has no components.
    The other is a file I wrote to save data program Data to a file.

    I'm using Mandrake 10. and have version j2sdk1.4.2_04 sdk

    The other problem I have with jar executable files is that I had a test
    program which displayed info info in the terminal, to test the program
    above (that saves program data). I sent that jar of those two classes
    over to my windows 2000 puter. to test it. but nothing displayed in the
    cli window, which i ran it in. but it did create all the files needed.

    Is there a problem with "System.out.println()" and cli, or perhaps I'm
    missing something in my jar file. I have the same sdk on the windows.
     
    Joe Vasher, May 12, 2004
    #1
    1. Advertising

  2. On Wed, 12 May 2004 07:53:23 -0400, Joe Vasher wrote:

    > I wrote a program that uses swing components when I created a jar file
    > it compiled and worked fine if you execute it in the netbeans(3.6) file
    > system. But when I copy the jar file to my desk top and run that with
    > "java -jar Calendar.jar" I get the following errors.
    >
    > java.lang.NoClassDefFoundError: javax/swing/JFrame


    It seems your class path does not
    point to the latest java..

    Open a command line (CLI/DOS),
    what does this report?

    java -version

    ...also

    path

    ( you can get 'path' using..
    <http://mindprod.com/wassup.html> )

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, May 13, 2004
    #2
    1. Advertising

  3. Joe Vasher

    Chris Smith Guest

    Joe Vasher wrote:
    > I wrote a program that uses swing components when I created a jar file
    > it compiled and worked fine if you execute it in the netbeans(3.6) file
    > system. But when I copy the jar file to my desk top and run that with
    > "java -jar Calendar.jar" I get the following errors.
    >
    > java.lang.NoClassDefFoundError: javax/swing/JFrame
    > at java.lang.ClassLoader.defineClass0 (ClassLoader.java)
    > at java.lang.ClassLoader.defineClass (ClassLoader.java:179)
    > at java.security.SecureClassLoader.defineClass
    > (SecureClassLoader.java:33)
    > at kaffe.lang.AppClassLoader$JarSource.findClass
    > (AppClassLoader.java:143)


    Okay, that's a stack trace from Kaffe.

    > I'm using Mandrake 10. and have version j2sdk1.4.2_04 sdk
    >


    You may have that version of Java installed, but it's not being used.
    Instead, you appear to be using a clean-room implementation called
    Kaffe. I can't find documentation on exactly what version of the Sun
    J2SDK Kaffe is compatible with, but there is some indication that it
    implements at least part of the javax.swing packages (there's a comment
    in a ChangeLog about integrating some GNU Classpath changes to
    EventListenerList). Nevertheless, whether the implementation of Swing
    is incomplete or you simply have an older version of Kaffe, the root of
    the problem is that Kaffe is being used at all.

    Try this:

    which java
    echo $PATH

    > The other problem I have with jar executable files is that I had a test
    > program which displayed info info in the terminal, to test the program
    > above (that saves program data). I sent that jar of those two classes
    > over to my windows 2000 puter. to test it. but nothing displayed in the
    > cli window, which i ran it in. but it did create all the files needed.
    >
    > Is there a problem with "System.out.println()" and cli, or perhaps I'm
    > missing something in my jar file. I have the same sdk on the windows.


    If you ran on Windows with javaw.exe, then it detaches the application
    from the command prompt by default. Try java.exe instead.

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, May 13, 2004
    #3
  4. Joe Vasher

    Joe Vasher Guest

    Chris Smith wrote:
    > Joe Vasher wrote:
    >
    >>I wrote a program that uses swing components when I created a jar file
    >>it compiled and worked fine if you execute it in the netbeans(3.6) file
    >>system. But when I copy the jar file to my desk top and run that with
    >>"java -jar Calendar.jar" I get the following errors.
    >>
    >>java.lang.NoClassDefFoundError: javax/swing/JFrame
    >> at java.lang.ClassLoader.defineClass0 (ClassLoader.java)
    >> at java.lang.ClassLoader.defineClass (ClassLoader.java:179)
    >> at java.security.SecureClassLoader.defineClass
    >>(SecureClassLoader.java:33)
    >> at kaffe.lang.AppClassLoader$JarSource.findClass
    >>(AppClassLoader.java:143)

    >
    >
    > Okay, that's a stack trace from Kaffe.
    >
    >
    >>I'm using Mandrake 10. and have version j2sdk1.4.2_04 sdk
    >>

    >
    >
    > You may have that version of Java installed, but it's not being used.
    > Instead, you appear to be using a clean-room implementation called
    > Kaffe. I can't find documentation on exactly what version of the Sun
    > J2SDK Kaffe is compatible with, but there is some indication that it
    > implements at least part of the javax.swing packages (there's a comment
    > in a ChangeLog about integrating some GNU Classpath changes to
    > EventListenerList). Nevertheless, whether the implementation of Swing
    > is incomplete or you simply have an older version of Kaffe, the root of
    > the problem is that Kaffe is being used at all.
    >
    > Try this:
    >
    > which java
    > echo $PATH
    >
    >
    >>The other problem I have with jar executable files is that I had a test
    >>program which displayed info info in the terminal, to test the program
    >>above (that saves program data). I sent that jar of those two classes
    >>over to my windows 2000 puter. to test it. but nothing displayed in the
    >>cli window, which i ran it in. but it did create all the files needed.
    >>
    >>Is there a problem with "System.out.println()" and cli, or perhaps I'm
    >>missing something in my jar file. I have the same sdk on the windows.

    >
    >
    > If you ran on Windows with javaw.exe, then it detaches the application
    > from the command prompt by default. Try java.exe instead.
    >


    Thanks Chris and Andrew I thought when I installed the sdk it would set
    the PATH for me. It was running kaffe, like version 1.1 or something.

    I manually went into my bash_profile and set the path to my sdk bin, it
    works great. Just in case you can't tell i'm new to linux. (I know its
    hard to notice.)

    works good now.
     
    Joe Vasher, May 13, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jay McGavren
    Replies:
    11
    Views:
    1,182
    Alan Krueger
    Jan 16, 2006
  2. Saverio M.
    Replies:
    0
    Views:
    557
    Saverio M.
    Jul 3, 2006
  3. Replies:
    0
    Views:
    375
  4. thunk
    Replies:
    1
    Views:
    360
    thunk
    Mar 30, 2010
  5. fl
    Replies:
    5
    Views:
    306
    Rui Maciel
    Jan 6, 2013
Loading...

Share This Page