Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing jdk without sudo?

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?

like image 475
Legend Avatar asked Mar 31 '10 01:03

Legend


People also ask

Do you need admin rights to install JDK?

Running the JDK InstallerYou must have administrator privilage to install the JDK on Microsoft Windows. To run the JDK installer: Start the JDK 9 installer by double-clicking the installer's icon or file name in the download location. Follow the instructions provided by the Installation wizard.


2 Answers

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.

like image 97
Thilo Avatar answered Sep 20 '22 00:09

Thilo


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).

like image 38
SyntaxT3rr0r Avatar answered Sep 18 '22 00:09

SyntaxT3rr0r