Forums Register Login

how to uninstall java 1.5?

+Pie Number of slices to send: Send
Hi,

I have ubuntu 8.04 and I'm looking forward of uninstalling the whole java 1.5. I don't know how it got installed on my system but I'm really frustrated sun hasn't made a simple uninstall. I do see java 6 in the synaptic package manager. when I try starting tomcat it gives the following message:

v@vcpu:/usr/share/tomcat5.5/bin$ start
start start-stop-daemon startx
v@vcpu:/usr/share/tomcat5.5/bin$ ./startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program


I don't understand why java isn't installed properly.



v@vcpu:~$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+Pie Number of slices to send: Send
 

bosey worthy wrote:I don't understand why java isn't installed properly.


Java itself is installed properly, but the environment variables haven't been set up properly. If you have the JDK installed you need JAVA_HOME to point to that, if you "only" have the JRE installed then the JRE_HOME is needed. Check this on how to set environment variables; although the FAQ is about the CLASS_PATH variable, the same steps can be used for JAVA_HOME as well.

v@vcpu:~$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


This means that you have also installed GCJ, part of the GCC suite, and it is located in your path before the Sun JRE / JDK. In other words, when it searches for the "java" command the GCJ version simply is found first. You can verify the location by typing "which java" - this tells you the path.

You can remedy this by changing the PATH environment variable, and put the Sun location first. Your PATH would become something like this:
or

Note that a) the new contents contain the value of either JAVA_HOME or JRE_HOME (this is what the $ does); if you change that variable and login again, the PATH variable gets updated automatically. Furthermore, you really really really want to include the old contents of PATH as well or none of your other programs will work.
+Pie Number of slices to send: Send
Hi Rob,

Here's a little more info:

v@vcpu:~$ which java
/usr/bin/java

v@vcpu:/usr/bin$ ls -al java
lrwxrwxrwx 1 root root 22 2009-02-14 17:26 java -> /etc/alternatives/java

v@vcpu:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

As you can see I don't have a Java Path in there, which I'll have to add.

Question: Do you know why Sun / unbuntu decided to leave the java path out of the environment variables? I'm new to ubuntu linux, and I've installed java 6 w/ the synaptic package manager. but because sun/ubuntu purposely did not add to the evironment variables, it makes me nervous as to what other stuff may be missing. I mean, at this point, how would anyone know what other procedure or steps are missing from a proper install? I'd hate to start compiling my stuff and then later find an error that's cryptic and is strictly related to installation issues rather than my code.

Thanks.
+Pie Number of slices to send: Send
The reason for requiring PATH setting is that Java is intended to be used from a command line or shell. I tried looking on my PC (also running Linux, but this is Fedora 10) to see what Java installations I have.

[Campbell@localhost ~]$ /usr/bin/java -version
java version "1.6.0_0"
IcedTea6 1.4 (fedora-9.b14.fc10-i386) Runtime Environment (build 1.6.0_0-b14)
OpenJDK Client VM (build 14.0-b08, mixed mode)
[Campbell@localhost ~]$ which java
/usr/java/jdk1.6.0_11/bin/java
[Campbell@localhost ~]$ java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

The first is the java version which is downloaded with Fedora, the second is the Sun installation which I downloaded myself.

I suggest you install a Sun JDK, available here. Use the one that doesn't have -rpm in its name. The installation instructions are here; you have got the one called self-extracting. It is probably a good idea to create a directory to hold your Java installation; you can see where I put mine. Remember carefully where you put it.

When I installed Java, I created a folder in /usr called java, then installed Sun Java in it, then went to home and edited .bashrc. This instruction only works if you use the Gnome desktop, and the bash shell, which I think Ubuntu does. I added a line to it

(not root) gedit ~/.bashrc

Add this sort of line

export PATH=/usr/java/jdk1.6.0_11/bin/:$PATH

Then save .bashrc, close your shell and reopen it. Only you will probably have _12 in your Java version.
+Pie Number of slices to send: Send
I agree with Campbell that it is better to install Sun Java, and not use the GCJ (GNU) version of Java which is installed by default. The GNU version of Java is slow and incomplete, so it does not run many Java programs correctly.

I'm an Ubuntu 8.04 user myself. The preferred way to install software on Ubuntu is via Ubuntu's package management system - that way, you will get automatic security updates etc., and installation is just a single command. Do this, instead of downloading the JDK from Sun's website, as Campbell suggests:

sudo apt-get install sun-java6-jdk

Then check with "java -version" if Sun Java is being used. If it isn't, then you can select the default Java to use with the following command:

sudo update-alternatives --config java

Note: You do not need to edit the PATH environment variable if you install Java this way, but you might need to set JAVA_HOME (which Tomcat uses to find Java). Open up the file ~/.profile with a text editor, and add the following line:

export JAVA_HOME=/usr/lib/jvm/java-6-sun
+Pie Number of slices to send: Send
I never knew you could use apt to install Java! Thank you
+Pie Number of slices to send: Send
 

Jesper Young wrote:
export JAVA_HOME=/usr/lib/jvm/java-6-sun



Hi Jesper,
Here's what I have:

v@vcpu:/usr/share/tomcat5.5/bin$ sudo update-alternatives --config java

There are 3 alternatives which provide `java'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-4.2
+ 2 /usr/lib/jvm/java-gcj/jre/bin/java
* 3 /usr/lib/jvm/java-6-sun/jre/bin/java



and I'm wondering if mine should now read export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/bin/java I'll some of the above links for install in the mean while.

Thanks.




+Pie Number of slices to send: Send
 

bosey worthy wrote:. . . I'm wondering if mine should now read export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/bin/java

Surely
export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/bin/ or export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/?

Have you installed a JRE or a JDK? You need a JDK, and it would probably be better for your JAVA_HOME to point to the JDK installation rather than the JRE.
+Pie Number of slices to send: Send
JAVA_HOME and JRE_HOME should not include the bin part: /usr/lib/jvm/java-6-sun/jre is enough.
+Pie Number of slices to send: Send
Thank you, Rob. I couldn't remember the exact format, so I gave both possibilities.
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 5270 times.
Similar Threads
How do I connect to toursdb of Derby database using ij in Ubuntu!
Failed to install Tomcat5 Service
Deploying a Visual Web Pack Application from Netbeans 5.5.1 to Tomcat 5.5
How to install tomcat5 in Ubuntu 11.04 when it is not in the apt-cache?
OK I give up: ClassNotFound error for modelmbean
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:19:53.