Results 1 to 3 of 3
- 01-23-2012, 03:02 AM #1
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:
Which I think means that I compiled the JAR in a higher version than I'm running it.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)
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)
- 01-23-2012, 03:39 AM #2
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
- 01-23-2012, 04:45 AM #3
Re: Compiling JAR with LOWER version of java?
javac -target ...
javac - Java programming language compiler
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Making string insensitive to upper or lower case
By ahmedaa16 in forum New To JavaReplies: 0Last Post: 10-21-2011, 12:59 PM -
javamail pop3 getmessagecount gives lower number
By mailme_gx in forum Advanced JavaReplies: 5Last Post: 04-30-2011, 08:56 PM -
Strings Lower/UpperCase
By jeata in forum New To JavaReplies: 1Last Post: 10-30-2010, 05:37 PM -
java -version pointing to older version
By deepakts in forum New To JavaReplies: 4Last Post: 05-06-2010, 09:59 AM -
Global Data Entry. Earn $2,000 a day use rebate lower price save money $$$
By arturmoniswork in forum Reviews / AdvertisingReplies: 0Last Post: 12-27-2008, 01:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks