Home arrow static arrow Java Programming [Archive] - java command line args?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - java command line args?
This topic has 6 replies on 1 page.

Posts:3
Registered: 7/19/04
java command line args?  
Jul 19, 2004 8:27 PM



 
Hello, I am running on Win XP and I have J2SE 1.4.2 and an older version of java (JDK 1.1.6) installed for compatability with this program: http://www.defectiverecords.com/202hack/mc202hack.html

I need to know, how do I specify that this program is to use JDK 1.1.6 to run instead of using J2SE 1.4.2? I can't seem to get this program to run b/c it always uses the newer JDK and gives me these errors:

Exception in thread "main" java.lang.ClassFormatError: Hack202 (Illegal constant
pool type)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

I'm sure I've set up my Path and Claspath variables correctly so I'm wondering, Is there something like a command line arg to use with "java" to specify use of the older JDK? I can't figure this one out...

thanks!

- Brian
 

Posts:3
Registered: 7/19/04
Re: java command line args?  
Jul 19, 2004 8:30 PM (reply 1 of 6)



 
shoot, i made a mistake...

instead of:
" I can't seem to get this program to run b/c it always uses the newer JDK and gives me these errors:"

I mean to say:
I can't seem to get this program to run b/c it always uses the newer J2SE 1.4.2 and gives me these errors:"
 

Posts:2,909
Registered: 13.8.2003
Re: java command line args?  
Jul 19, 2004 10:38 PM (reply 2 of 6)



 
I think you'd need to point your JAVA_HOME and CLASSPATH and other variables to the older JDK.

You could ask the author to write a newer version too (or if the license permits, ask someone else to write it).
 

Posts:10,967
Registered: 4/7/01
Re: java command line args?  
Jul 19, 2004 10:43 PM (reply 3 of 6)



 
Java installs a copy of java.exe and javaw.exe in the system32 folder - this copy is usually found first when you do a default "java ----------" command, due to the PATH listing sequence.

For applications, place whichever version you want to be the default in the folder; then use a full path that points to the other version when you want to execute it.

If you need to change versions in the Java plug-in (applets, etc), you'll need to open it and make then version selection in the Advanced tab..
 

Posts:3
Registered: 7/19/04
Re: java command line args?  
Jul 22, 2004 3:17 AM (reply 4 of 6)



 
oh, i don't even have a JAVA_HOME environment variable... what are its values supposed to be?

to tell the truth i don't have a full grasp of this environment variable stuff as it pertains to java... is it even possible to run these two java environments on the same machine or am I causing a conflict trying to have them both? It seems like the newer java should be able to run this older code... or has java just evolved so much that the program has become outdated? Whatever happened to backwards compatability?

thanks for the info so far.
 

Posts:2,909
Registered: 13.8.2003
Re: java command line args?  
Jul 22, 2004 3:41 AM (reply 5 of 6)



 
Well, actually JAVA_HOME is a bit blurry in my mind too, usually you don't need it, sometimes you do...etc. etc.

It's certainly possible to have multiple JREs on one machine, but then you just gotta fiddle with the env vars...

You could try making a JAVA_HOME environment variable that points to c:\foo\java1.1\ and see if it helps.

Hope you get it to work.
 

Posts:21,719
Registered: 98-02-20
Re: java command line args?  
Jul 22, 2004 4:38 AM (reply 6 of 6)



 
You'd have to compile the code using the older version of Java. I believe there's a -target switch where you can specify which version of JDK you want to compile against. Running would be a matter of putting the full path to the 1.1.6 JDK java.exe, right?

%
 
This topic has 6 replies on 1 page.