Results 1 to 3 of 3
  1. #1
    nhmllr's Avatar
    nhmllr is offline Member
    Join Date
    Aug 2011
    Posts
    51
    Rep Power
    0

    Default Compiling JAR with LOWER version of java?

    I programmed a little helpful program with the 64-bit Java 6.0 on a computer running Windows-7
    There's nothing in the program that would restrict it from running on my mac, which is what I'm trying to do now
    (The JAR works fine on my PC)

    The thing is that my mac is a little old, and even with the newest version available (that I could find for it) I still get this:
    Java Code:
    Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    Which I think means that I compiled the JAR in a higher version than I'm running it.
    There's nothing super-advanced about my program, I'm sure it could run fine in lower versions.

    Is there a way to actually compile it with a lower version of Java so that it can run on more machines?

    Thanks!

    By the way, I'm running Mac OS X 10.5.8
    This is the update I used:
    Java for Mac OS X 10.5 Update 4
    And here's what my mac says it's running, but I can't tell if it's the same thing, or the right thing
    Java Code:
    java version "1.5.0_20"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02-315)
    Java HotSpot(TM) Client VM (build 1.5.0_20-141, mixed mode, sharing)

  2. #2
    nhmllr's Avatar
    nhmllr is offline Member
    Join Date
    Aug 2011
    Posts
    51
    Rep Power
    0

    Default Re: Compiling JAR with LOWER version of java?

    Okay, the funniest thing. It turns out that even if you HAVE Java 6.0 on your mac it won't run until you physically DRAG it to the top of a list
    This list can be found be searching for "Java Preferences" and seeing a little list of all the versions. Drag Java 6.0 to the top

    But if anyone knows how to compile in lower versions I'd still like to know :p

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Compiling JAR with LOWER version of java?

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

Similar Threads

  1. Making string insensitive to upper or lower case
    By ahmedaa16 in forum New To Java
    Replies: 0
    Last Post: 10-21-2011, 01:59 PM
  2. javamail pop3 getmessagecount gives lower number
    By mailme_gx in forum Advanced Java
    Replies: 5
    Last Post: 04-30-2011, 09:56 PM
  3. Strings Lower/UpperCase
    By jeata in forum New To Java
    Replies: 1
    Last Post: 10-30-2010, 06:37 PM
  4. java -version pointing to older version
    By deepakts in forum New To Java
    Replies: 4
    Last Post: 05-06-2010, 10:59 AM
  5. Global Data Entry. Earn $2,000 a day use rebate lower price save money $$$
    By arturmoniswork in forum Reviews / Advertising
    Replies: 0
    Last Post: 12-27-2008, 02: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
  •