Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-01-2007, 08:31 PM
Member
 
Join Date: Jun 2007
Location: Colombo, Sri Lanka
Posts: 32
hiranya is on a distinguished road
Problem with executing .jar files
Hi Everyone,

I'm developing using NetBeans 5.5 on Ubuntu Linux 7.04. Whenever I attempt to execute the Java applications I have developed directly from the Linux terminal (by executing the .jar file) I get an error. The following error appeared when I attempted to execute a simple HelloWorld application. Error is always the same.

hiranya@hiranya-homepc:~$ java -jar "/home/hiranya/projects/netbeans/HelloWorld/dist/HelloWorld.jar"
Exception in thread "main" java.lang.ClassFormatError: helloworld.Main (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.70)
at java.lang.ClassLoader.defineClass(libgcj.so.70)
at java.security.SecureClassLoader.defineClass(libgcj .so.70)
at java.net.URLClassLoader.findClass(libgcj.so.70)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj .so.70)
at java.lang.ClassLoader.loadClass(libgcj.so.70)
at java.lang.ClassLoader.loadClass(libgcj.so.70)
at gnu.java.lang.MainThread.run(libgcj.so.70)
hiranya@hiranya-homepc:~$


Please enlighten me on what's going on and possible workarounds.

Thank you

Regards,
Hiranya
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-01-2007, 08:53 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Check version of the compiler you are using and the java interpreter!

For the compiler, you can check project properties by right clicking on your project. Somewhere there, it shows you which java version is your target for your class files. If it is targetted for java 1.6 but you try to run it with java 1.5 then it will report this error. Class format changes from version to version..

And you can check the version of the java interpreter you are using with your console by running following command on your console (I guess you are using gcj which as the interpreter and you should use java command in your JDK'sbin directory to solve the problem.):

java -version
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 10-02-2007, 09:24 PM
Member
 
Join Date: Jun 2007
Location: Colombo, Sri Lanka
Posts: 32
hiranya is on a distinguished road
Thanks for the tip. It worked.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with executing mcal New To Java 2 02-09-2008 03:51 PM
problem with viewing .java files when Visual J# 2005 Express Edition exist unhurt New To Java 3 11-03-2007 03:58 PM
Executing Batch zcoarens New To Java 0 08-14-2007 11:49 AM
Problem while executing programs bks504 New To Java 10 08-02-2007 03:32 PM
Executing a jar file peiceonly New To Java 2 04-06-2007 04:32 PM


All times are GMT +3. The time now is 03:13 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org