Results 1 to 3 of 3
  1. #1
    hiranya is offline Member
    Join Date
    Jun 2007
    Location
    Colombo, Sri Lanka
    Posts
    32
    Rep Power
    0

    Question 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

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    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

  3. #3
    hiranya is offline Member
    Join Date
    Jun 2007
    Location
    Colombo, Sri Lanka
    Posts
    32
    Rep Power
    0

Similar Threads

  1. Executing a jar file
    By peiceonly in forum New To Java
    Replies: 7
    Last Post: 02-14-2014, 10:02 AM
  2. Problem with executing
    By mcal in forum New To Java
    Replies: 2
    Last Post: 02-09-2008, 02:51 PM
  3. Replies: 3
    Last Post: 11-03-2007, 02:58 PM
  4. Executing Batch
    By zcoarens in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 10:49 AM
  5. Problem while executing programs
    By bks504 in forum New To Java
    Replies: 10
    Last Post: 08-02-2007, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •