Reputation: 42454
How to use the same version of java 1.7 for both java and javac, on my centos I am getting results like this...
for command java -version:
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)
for command javac -version:
javac 1.6.0_24
how to use 1.7 for javac too? If I need to update JAVA_HOME variable how can I update it? (using what command)
Upvotes: 5
Views: 5651
Reputation: 3787
You need to update PATH variable to include the bin directory of your correct JDK .
Make sure your PATH has your JDK bin folder before any other JDK/JRE installation by adding it in begining of your PATH.
Run below from your Korn or bash shell (console):
export JAVA_HOME=jdk-install-dir
export PATH=$JAVA_HOME/bin:$PATH
Upvotes: 1
Reputation: 1445
set JAVA_HOME =C:..... the path where your java 7 is present upto the bin location
example
SET JAVA_HOME=C:\Program Files\Java\jdk_1.7.1
SET JAVA=%JAVA_HOME%\bin\java
Upvotes: 0
Reputation: 11906
Maybe you have just installed a 1.6 JDK and a 1.7 JRE. To keep both at the same level, just install the 1.7 JDK. Try this command:
su -c "yum install java-1.7.0-openjdk"
Upvotes: 1