Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > jar file executes fine in netbeans file manager but on its own...

Reply
Thread Tools

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

 
 
Joe Vasher
Guest
Posts: n/a
 
      05-12-2004
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.
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      05-13-2004
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
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      05-13-2004
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
 
Reply With Quote
 
Joe Vasher
Guest
Posts: n/a
 
      05-13-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
if statement that, when false, skips first statement in its block, executes second? Jay McGavren Java 11 01-16-2006 05:49 PM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM



Advertisments