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

J

Joe Vasher

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.
 
A

Andrew Thompson

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> )
 
C

Chris Smith

Joe said:
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
 
J

Joe Vasher

Chris said:
Okay, that's a stack trace from Kaffe.




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




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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top