This content has been marked as final. Show 4 replies
To set up its default Java environment, SuSE uses a combination of symbolic links and a script called /etc/profile.d/alljava.sh. This can be a real hassle if you want to set up your own JDK. Anyway, this is what I did to set up mine:
* I installed my JDK to /usr/local/jdk1.5.0_05
* Under version 9.x, it was possible to replace the SuSE-created java symbolic link in /usr/lib by using something like ln -s/usr/local/jdk1.5.0_05 java. After logging out and back in, the alljava.sh script will use this symbolic to set up all the necessary environment variables. But, alljava.sh has changed between versions 9.x and 10.0 (The two versions are at the end of this post if anyone is interested).
* Deleted any java* symbolic links under /etc/bin
* I'm using version 10.0 and I gave up struggling with alljava.sh, so in my .profile file I just unset everything done by alljava.sh, and set my own:
I'm sure there's a more elegant way of doing this, but eventually you have to get down and do some work rather than battling with your tools.
unset JDK_HOME unset JAVA_BINDIR unset JAVA_HOME unset JRE_HOME unset SDK_HOME unset JAVA_ROOT export JAVA_HOME=/usr/local/jdk1.5.0_05 export PATH=$PATH:$JAVA_HOME/bin:.:
alljava.sh version 9.x
alljava.sh version 10.0
# # /etc/profile.d/alljava.sh # # send feedback to http://www.suse.de/feedback # # This script sets some environment variables for default java. # Affected variables: PATH, JAVA_BINDIR, JAVA_HOME, JRE_HOME, # JDK_HOME, SDK_HOME # if [ -x /usr/lib/java/bin/java ] || [ -x /usr/lib/java/bin/jre ] ; then export PATH=$PATH:/usr/lib/java/bin export JAVA_BINDIR=/usr/lib/java/bin export JAVA_ROOT=/usr/lib/java export JAVA_HOME=/usr/lib/java if [ -x /usr/lib/java/jre/bin/java ] ; then export JRE_HOME=/usr/lib/java/jre else export JRE_HOME=/usr/lib/java fi unset JDK_HOME unset SDK_HOME if [ -x /usr/lib/java/bin/javac ] ; then # it is development kit if [ -x /usr/lib/java/bin/jre ] ; then export JDK_HOME=/usr/lib/java else export JDK_HOME=/usr/lib/java export SDK_HOME=/usr/lib/java fi fi else if [ -x /usr/lib/java/jre/bin/java ] ; then # it is IBMJava2-JRE or SunJava2-JRE export PATH=$PATH:/usr/lib/java/jre/bin export JAVA_BINDIR=/usr/lib/java/jre/bin export JAVA_ROOT=/usr/lib/java export JAVA_HOME=/usr/lib/java/jre export JRE_HOME=/usr/lib/java/jre unset JDK_HOME unset SDK_HOME fi fi
# # /etc/profile.d/alljava.sh # # send feedback to http://www.suse.de/feedback # # This script sets some environment variables for default java. # Affected variables: PATH, JAVA_BINDIR, JAVA_HOME, JRE_HOME, # JDK_HOME, SDK_HOME # __libdir=lib if [ -x /usr/lib64/jvm/java ] || [ -x /usr/lib64/jvm/jre ] ; then __libdir=lib64 fi if [ -x /usr/$__libdir/jvm/java/bin/java ] || [ -x /usr/$__libdir/jvm/java/bin/jre ] ; then export JAVA_BINDIR=/usr/$__libdir/jvm/java/bin export JAVA_ROOT=/usr/$__libdir/jvm/java export JAVA_HOME=/usr/$__libdir/jvm/java if [ -x /usr/$__libdir/jvm/java/jre/bin/java ] ; then export JRE_HOME=/usr/$__libdir/jvm/java/jre else export JRE_HOME=/usr/$__libdir/jvm/java fi unset JDK_HOME unset SDK_HOME if [ -x /usr/$__libdir/jvm/java/bin/javac ] ; then # it is development kit if [ -x /usr/$__libdir/jvm/java/bin/jre ] ; then export JDK_HOME=/usr/$__libdir/jvm/java else export JDK_HOME=/usr/$__libdir/jvm/java export SDK_HOME=/usr/$__libdir/jvm/java fi fi else if [ -x /usr/$__libdir/jvm/jre/bin/java ] ; then # it is IBMJava2-JRE or SunJava2-JRE export PATH=$PATH:/usr/$__libdir/jvm/jre/bin export JAVA_BINDIR=/usr/$__libdir/jvm/jre/bin export JAVA_ROOT=/usr/$__libdir/jvm/jre export JAVA_HOME=/usr/$__libdir/jvm/jre export JRE_HOME=/usr/$__libdir/jvm/jre unset JDK_HOME unset SDK_HOME fi fi unset __libdir
I would like to set up my java environment in Suse 10.0, but I was not successful in following such explanation. After changing .profile and opening a new shell, typing java command does not give any results, this command was not found.
I using jdk-1_5_0_06-linux-i586.bin.
Trying logging off and back on again. This should do the trick.
Noticed the following in my install
alljava.sh: export JRE_HOME=/usr/$_libdir/jvm/jre
I change it to $__libdir (double underscore)
and that fixed it.