Results 1 to 7 of 7
  1. #1
    cccgsmith is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Problem running program on other computers

    I am using NetBeans to write beginning Java programs. Sometimes my program will run at home, but when I try to run the same program at school, I get a series of error messages, usually of this form:

    run:
    java.lang.UnsupportedClassVersionError: shapebase/Project : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader. java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :615)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader .java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader. java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    Could not find the main class: shapebase.Project. Program will exit.
    Exception in thread "main" Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)

    Of course the messages vary some due to different class names, etc, but they are essentially the same. Further more, if I create a new project on the second computer and copy the code into it, it works fine. What is probably causing this problem? Hopefully it is something simple I am neglecting!

    Thanks!

  2. #2
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: Problem running program on other computers

    A quick google search will give you your answer, its to do with the JDK you use to compile the program.

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,017
    Blog Entries
    7
    Rep Power
    20

    Default Re: Problem running program on other computers

    Quote Originally Posted by wdh321 View Post
    A quick google search will give you your answer, its to do with the JDK you use to compile the program.
    Nope, it's just different versions of the Java virtual machine.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    cccgsmith is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Re: Problem running program on other computers

    Quote Originally Posted by wdh321 View Post
    A quick google search will give you your answer, its to do with the JDK you use to compile the program.
    How can Java claim portability if one has to be careful of matching JDKs or JVMs when going from one machine to another and not get such a problem? This confuses me! This question probably really proves I am a beginner!

  5. #5
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: Problem running program on other computers

    Quote Originally Posted by JosAH View Post
    Nope, it's just different versions of the Java virtual machine.

    kind regards,

    Jos
    Sorry JVM, the correct answer pops up in the search though:)

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,602
    Rep Power
    23

    Default Re: Problem running program on other computers

    It's the JDK that sets the version in the class file. A younger version JRE can run a class file from an older version of the JDK/javac command.

    one has to be careful of matching JDKs or JVMs
    That's a problem for a lot of software and hardware. Backward compatibility has been a headache for decades. Newer features are not known by older versions of software. My wife works with multiple versions of MS Word and has cussed out the people that insist on using the newest versions many times.
    Last edited by Norm; 04-28-2012 at 12:59 PM. Reason: spelling
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Problem running program on other computers

    Quote Originally Posted by cccgsmith View Post
    How can Java claim portability if one has to be careful of matching JDKs or JVMs when going from one machine to another and not get such a problem? This confuses me! This question probably really proves I am a beginner!
    No, it proves you don't really understand the concept of portability.

    Learn your IDE. NetBeans has a per-project setting for the Java version for which it compiles your sources.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 4
    Last Post: 04-24-2012, 08:08 PM
  2. Problem running DataGimmick program!!
    By Bentino in forum New To Java
    Replies: 1
    Last Post: 02-21-2012, 09:18 PM
  3. Need to have multiple computers run same java program
    By thehighlander12 in forum Networking
    Replies: 11
    Last Post: 07-07-2010, 02:30 PM
  4. Problem with running an external program via java
    By g123456 in forum New To Java
    Replies: 4
    Last Post: 12-30-2009, 05:06 PM
  5. Replies: 0
    Last Post: 12-24-2008, 10:35 AM

Posting Permissions

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