views:

50

answers:

2

Currently, I have a machine on which I am working in Eclipse, it says that the JRE System Library version is sun-jdk-1.5.0.11 but on my active development machine, it is java-6-sun-1.6.0.16. Is there any way I can make the first machine to use the same "java-6-sun-1.6.0.16" version without having sudo permissions on the machine?

+4  A: 

You can install the JDK in a non-standard directory, for example under your own home directory, without special permissions.

You just need to point PATH and JAVA_HOME and Eclipse at it.

Thilo
+1  A: 

The great thing with Java on Linux (and quite some other Unices) is that you don't need the "root" password to install it. I do this all the time. This is in sharp contrast with Windows where, last time I checked, it was impossible to install Java without having an admin password.

All you need is a repertory in which you put the JRE (or JDK) and then put it on the path:

... $ export PATH=~/jdk1.6.0_17/bin:$PATH

... $ which java
/home/wizard/jdk1.6.0_17/bin/java

... $ java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Server VM (build 14.3-b01, mixed mode)

In the same vein, you can keep several JVM in the same user account and simply change the path as needed (or point your IDE to the correct JVM: for example I'm running IntelliJ IDEA with an 1.6 VM but compiling and runnning all my unit tests using a 1.5 VM).

Webinator