I am installing java to my Linux machine. Downloading the jre and jdk and extracting them did not help only - I assume some environmental variables are also needed. What all path var开发者_如何学JAVAiables are needed to be set? With which values? Expecting the java installs itself to <installation-dir>
?
Depending on your distribution it may be easiest to install from your package manager. On Ubuntu, for example, you can do:
sudo aptitude install open-jdk
Otherwise, usually the sun (oracle) version of java comes with a .bin file which you need to make executable and run as root in order to get java properly installed.
You shouldn't need to set any environment variables to get java to work, although some applications will require you to set JAVA_HOME, JDK_HOME and/or JRE_HOME to point to the java install's bin directory. You can see where your java install is by looking at where the symlink from
/etc/alternatives/java
points.
Most Linux systems use the Gnu Java implementation by default and don't change this if you install an additional JDK. Therefore you need to explicitly make your new Java installation the default Java to be used. You can do so by running sudo update-alternatives --config java
.
If you prefer graphical configuration, you can install the "galternatives" package, which lets you configure all those application defaults in a nice little UI.
You just need to make /usr/bin/java
point to the java
executable in the directory where you had extracted the JRE/JDK.
If you extracted it to, say, /opt/jdk1.6.0_23/bin/java
, then you need to create a link like this:
sudo ln -s /opt/jdk1.6.0_23/bin/java /usr/bin/java
Prior to this, you can choose to backup an old java installation by:
sudo mv /usr/bin/java /usr/bin/java_old
Here is how I installed JRE: Install Sun Java Runtime.
Get the jdk for linux. Go to the root Directory. Use the following commands to install.
./configure make make install
PATH .= New Path where Java is installed.
To go to the root directory for UBUNTU use command "sudo". For FEDORA use "su".
精彩评论