Pages

20 July 2012

Oracle JDK 1.7 Installation on OpenSUSE 12.1

There is no so complex problem when using rpm distribution of Oracle JDK 1.7. First of all, filter installed version of OpenJDK to uninstall it.


linux-4e1s:/home/oguzhan/Desktop # rpm -qa | grep jdk
java-1_6_0-openjdk-1.6.0.0_b24.1.11.5-16.1.x86_64

linux-4e1s:/home/oguzhan/Desktop # rpm -e java-1_6_0-openjdk-1.6.0.0_b24.1.11.5-16.1.x86_64
warning: /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/fontconfig.SuSE.properties saved as /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/fontconfig.SuSE.properties.rpmsave
update-alternatives: warning: alternative /usr/lib64/jvm/jre-1.6.0-openjdk/bin/java (part of link group java) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: /etc/alternatives/java is dangling, it will be updated with best choice.
update-alternatives: warning: alternative /usr/lib64/jvm/jre-1.6.0-openjdk (part of link group jre_openjdk) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: /etc/alternatives/jre_openjdk is dangling, it will be updated with best choice.
update-alternatives: warning: alternative /usr/lib64/jvm/jre-1.6.0-openjdk (part of link group jre_1.6.0) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: /etc/alternatives/jre_1.6.0 is dangling, it will be updated with best choice.

linux-4e1s:/home/oguzhan/Desktop # rpm -qa | grep jdk
linux-4e1s:/home/oguzhan/Desktop # java -version
bash: /usr/bin/java: No such file or directory

I ensure that OpenJDK is uninstalled completely with listing rpm packages(rpm -qa | grep jdk), again. Then, call "rpm -ivh" to install oracle JDK 1.7 64-bit version. Finally, java and javac commands works well as you see bottom of the terminal output.
rpm -ivh jdk-7u9-linux-x64.rpm

linux-4e1s:/home/oguzhan/Desktop # rpm -ivh jdk-7u9-linux-x64.rpm
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
 rt.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_09/jre/lib/rt.pack
 jsse.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_09/jre/lib/jsse.pack
 charsets.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_09/jre/lib/charsets.pack
 tools.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_09/lib/tools.pack
 localedata.jar...
Error: Could not open input file: /usr/java/jdk1.7.0_09/jre/lib/ext/localedata.pack
linux-4e1s:/home/oguzhan/Desktop # 
linux-4e1s:/home/oguzhan/Desktop # 
linux-4e1s:/home/oguzhan/Desktop # 
linux-4e1s:/home/oguzhan/Desktop # java -version
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
linux-4e1s:/home/oguzhan/Desktop # 
linux-4e1s:/home/oguzhan/Desktop # 
linux-4e1s:/home/oguzhan/Desktop # 
linux-4e1s:/home/oguzhan/Desktop # javac
Usage: javac  
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
...
...
...


All essential java commands seem works fine but there is something we have to commit, finally: Setting JAVA_HOME directory in PATH.

1) grant access under the /etc/profile.d with root
linux-4e1s:/etc/profile.d # su


2) create jdk.sh file under /etc/profile. and write output of below echo command
linux-4e1s:/etc/profile.d # echo 'export JAVA_HOME=/usr/java/jdk1.7.0_05'>/etc/profile.d/jdk.sh 


3) append output of echo command
linux-4e1s:/etc/profile.d # echo 'export PATH=$JAVA_HOME/bin:$PATH'>>/etc/profile.d/jdk.sh


4) trigger jdk.sh
linux-4e1s:/etc/profile.d # source /etc/profile.d/jdk.sh


Finally, You have to logout and login to see the effect with your own user. 

Thanks for visiting,
Take care...

No comments:

Post a Comment

Thx for reading! Comments are appreciated...