go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Set environment variable JAVA_HOME
 
Subject: Set environment variable JAVA_HOME
Author: AwsEC2
In response to: Install JDK 64-bit version
Posted on: 08/28/2012 06:59:03 PM

After changing any environment settings, you have to log off to let the changes take effect.

Quick notes on vi:

1) Start vi
vi <filename>

2) Browse
:$ -- Last line
:0 -- First line

3) Insert
i <changes> Esc

4) Copy-Paste
yy -- copy current line
yNy -- copy N lines
p -- paste

5) Search
/<str> -- search for <str>

6) Exit vi:
:x -- to eXit (save+quit)
:q -- to quit
:q! -- to quit without save



 

> On 08/28/2012 02:21:51 PM AwsEC2 wrote:


Download a JDK RPM from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Look for "linux-x64-rpm" and download JDK 64-bit version from http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jdk-6u34-linux-x64-rpm.bin

Step 1). Make the folder available
# mkdir /usr/local/java
# cd /usr/local
# chmod 777 java


Step 2). Upload the downloaded JDK by WinSCP

Copy jdk-6u34-linux-x64-rpm.bin onto /usr/local/java/

Step 3). Install JDK

Then follow the instructions on http://alwajdi.blogspot.com/2007/12/how-to-install-snns-jdk-in-fedora-8.html to install the downloaded JDK.

# chmod 755 jdk-6u34-linux-x64-rpm.bin
# ./jdk-6u34-linux-x64-rpm.bin


Note: The installed JDK jdk1.6.0_34 will be under /usr/java/

Step 4). Override the default JDK link

The AWS-Linux instance comes with a built-in JDK. You can find it out by:

$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (amazon-52.1.11.3.45.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)


Which is OpenJDK 64-Bit Server VM.

Where does it locate? You can find it out by:

$ which java
/user/bin/java


How to override this default built-in JDK? You can do it by alternatives:

alternatives --install <link> <name> <path> <priority>


# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_34/bin/java 100
# /usr/sbin/alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_34/bin/jar 100
# /usr/sbin/alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_34/bin/javac 100
# /usr/sbin/alternatives --config java


Step 5). Just make sure everything is correct
# java -version
java version "1.6.0_34"
Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixed mode)






References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.