Solved

JDK 1.6 on Solaris

Posted on 2010-11-16
16
1,725 Views
Last Modified: 2013-12-27
I have Solaris 10 and I install JDK 1.6 into /usr/jdk but when I look at version by:
java -Xmx4096 -version
I was surprised with this reply:
java version "1.5.0_20"
Please advice how to remove old JDK versions and left only last one?
Thank you
0
Comment
Question by:gbcbr
  • 9
  • 3
  • 3
  • +1
16 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 34148073
the issue is with the settings of your PATH
run which java and you will likely see:
/usr/bin/java or /usr/local/bin/java.

Depending on your shell, you may need to do export PATH=/usr/jdk/bin:$PATH.

removing the older version should depend on whether it is needed for system management.
pkginfo
Locate the Java Pacakage
pkginfo -i or -l packagename will provide info on the package.

NOTE: be very careful with removing packages. SUNWjava is merely used as an example for the java package name.
pkgrm SUNWjava.
0
 

Author Comment

by:gbcbr
ID: 34148143
NetBeans shows that it use 1.6, but I try to set -Xms on it and found 1.5
So, if I use Java only for NetBeans at the moment I can leave it as it is ?
Just advice how to put VM parameters in 1.6
0
 
LVL 77

Expert Comment

by:arnold
ID: 34148215
I'm not sure what you are asking.

If you add the /usr/jdk/bin to the search path
sh/bash
export PATH=/usr/jdk/bin:$PATH
csh
setenv path=/usr/jdk/bin:$path

Will change the behavior, you could also do alias java="/usr/jdk/bin/java"


0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:gbcbr
ID: 34148343
In /usr/jdk I have:
# cd /usr/jdk
# ls
instances      jdk1.5.0_20    latest
j2sdk1.4.2_22  jdk1.6.0_21    packages
#
0
 

Author Comment

by:gbcbr
ID: 34148419
apart of jdk I have also java and j2se in /usr
everything were installed with Solaris, this reason I ask how to clean it from unused old versions and leave one, new one
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34148431
I would set JAVA_HOME to the one you want and then

export PATH=${JAVA_HOME}/bin:${PATH}
0
 

Author Comment

by:gbcbr
ID: 34148490
# JAVA_HOME=/usr/jdk/jdk1.6.0_21
# export PATH=${JAVA_HOME}/bin:${PATH}
PATH=/usr/jdk/jdk1.6.0_21/bin:/usr/sbin:/usr/bin: is not an identifier
#
0
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 34148539
YOu seem to have /bin/sh which means you have to use a two step:
JAVA_HOME=/usr/jdk/jdk1.6.0_21
PATH=${JAVA_HOME}/bin:${PATH}
export PATH
0
 

Author Comment

by:gbcbr
ID: 34148609
# $JAVA_HOME
/usr/jdk/jdk1.6.0_21: cannot execute
# java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

Ok, this is clear, but what to do with garbage?
0
 
LVL 16

Expert Comment

by:Joseph Gan
ID: 34148724
You can try like:

# which java
this will show the path for current java, eg. /usr/bin/java, normally this is a symbolic link.

To cleanup old java, just remove this link.

Then, create a symbolic link to your new java command where ever is:

# ln -s {new java path} /usr/bin/java (example only, depend on "which java" command output).
0
 

Author Comment

by:gbcbr
ID: 34148769
# which java
/usr/jdk/jdk1.6.0_21/bin/java

so, now it's correct java and I can delete all old versions from jdk folder and leave only 1.6?
But what to do with folders java and j2se?
0
 
LVL 16

Expert Comment

by:Joseph Gan
ID: 34148800
Yes, you can delete all old java pathes/directoies, if you sure not going to use. But don't remove any packages if you don't know.
0
 

Author Comment

by:gbcbr
ID: 34148852
Just for last confirmation before deleting:
I will leave in usr/jdk folder only two folders: 1.6 and packages and all other related to java delete, including folders java and j2se?
0
 
LVL 16

Expert Comment

by:Joseph Gan
ID: 34148940
Should be ok, but if you can copy/backup to somewhere else before delete just in case.
0
 

Author Comment

by:gbcbr
ID: 34149011
you know that the best treatment for dandruff is a guilliotine :-)
0
 

Author Closing Comment

by:gbcbr
ID: 34149032
Thank you for real practical help!
Please check another my question about Java VM
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 50
ejb wildfly example 2 15
Expiration and Locking of Unix/Solaris OS Accounts 7 48
JAVA API design with micro service cloud in mind 1 41
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question