You are not logged in.

#1 2005-02-21 19:00:28

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 163

Multiple JDKs

Does anyone know of a simple way to switch between multiple JDKs?

Offline

#2 2005-02-21 19:51:26

soniX
Member
From: Oslo, Norway
Registered: 2004-01-23
Posts: 161

Re: Multiple JDKs

use full path to java or javac

may I ask what you need this for, as java5 aka java 1.5 aka tiger can compile backward compatible code with the target flag.

if you want to "let the whole system know" I guess you could just export the new JAVA_HOME and CLASSPATH variables you want to use before starting the vm

Offline

#3 2005-02-21 22:30:02

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 163

Re: Multiple JDKs

My work is still officially using 1.3.1 (yuck) but getting ready to use 1.4.2. They are not willing as of yet to go with 1.5 but we (the developers) will convince them.

Offline

#4 2005-02-22 00:39:02

soniX
Member
From: Oslo, Norway
Registered: 2004-01-23
Posts: 161

Re: Multiple JDKs

you can set what version you want when compiling using 1.5

javac -source 1.3 will fail on all stuff introduced after 1.3 such as generics(1.5) and assert(1.4)
even though you are compiling it with a 1.5 compiler

so it really doesnt matter what version you are using since you can compile everything backward compatible.

install 1.5, and let it pretend it is a 1.3 and spend you lunches lobbying for 1.5

Offline

#5 2005-02-22 14:11:42

cbozic
Member
From: Morgantown, WV, USA
Registered: 2004-01-31
Posts: 77

Re: Multiple JDKs

Setting the source version isn't always a safe bet.  There are several API changes in rt.jar that will compile fine as 1.3 or 1.4 using the 1.5 compiler.  However, when you take that bytecode and run it on a 1.3 or 1.4 JRE you will get ClassNotFound or NoSuchMethod exceptions all over the place. 

Bottom line is, the compiling for older versions works great in 1.5.   Just make sure your test environment is set up with the proper support jars in the classpath to C.Y.A.

Offline

#6 2005-02-22 17:28:58

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 163

Re: Multiple JDKs

Well directly calling the java command fails. I get this

/opt/jdk1.3.1_15/bin/i386/native_threads/java: error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory

I don't seem to have this library. Not sure what to do

Offline

#7 2005-02-22 17:44:27

cbozic
Member
From: Morgantown, WV, USA
Registered: 2004-01-31
Posts: 77

Re: Multiple JDKs

Can you give us some more information?  ...Like how did you build your code (switches and compiler version) and what JRE are you trying to run it on.  Also, if you can give a simple code example, that would help.

Offline

#8 2005-02-22 18:59:20

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 163

Re: Multiple JDKs

The only real reason I NEED 1.3.1 is the stupid way my predecessor created the encryption for passwords. We've worked around it but have yet to switch to 1.4.2. Once we switch then this will be useless but I solved my problem. The library I am missing is actually

libstdc++-2-libc6.1-1-2.9.0.so

So I just copied it over from another Linux machine (different distro) and it worked.

Offline

Board footer

Powered by FluxBB