Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
06-01-2012, 08:55 AM
|
#1
|
Member
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215
Rep:
|
How to Install java
I have downloaded:
jdk-7u4-linux-x64.tar.gx.
How do I install this???
|
|
|
06-01-2012, 09:02 AM
|
#2
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
You mean ......tar.gz (I hope)
Also, if you want to install the java runtime, you need jre, not jdk
first, you extract using this:
tar -xzvf <filename>
The result will usually include some kind of "README" or other documentation
BUT---is java not available using your package manager?
|
|
|
06-01-2012, 09:09 AM
|
#3
|
Member
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215
Original Poster
Rep:
|
Yes gz (typo)
I have installed eclipse and when I launch it it says:
Incompatible JVM (as superuser)
Version 1.4.2 of the JVM is not suitable for this product. Version 1.5 or greater is required"
The readme jsut says to go their website and view the licencereadme file.
OK Now I have it extracted into a folder jdk1.7.0_04
How do I make this the default java install directory??
|
|
|
06-01-2012, 09:18 AM
|
#4
|
Member
Registered: Jun 2012
Location: Missouri, USA
Posts: 236
Rep:
|
Quote:
Originally Posted by HarryBoy
Yes gz (typo)
I have installed eclipse and when I launch it it says:
Incompatible JVM (as superuser)
Version 1.4.2 of the JVM is not suitable for this product. Version 1.5 or greater is required"
The readme jsut says to go their website and view the licencereadme file.
OK Now I have it extracted into a folder jdk1.7.0_04
How do I make this the default java install directory??
|
I'm not sure what did you mean by 'the default java install directory' but you may want setting/exporting your JAVA_HOME env variable to this directory so eclipse would know that this version is in place.
|
|
|
06-01-2012, 09:18 AM
|
#5
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by HarryBoy
.....
How do I make this the default java install directory??
|
I don't think you would.....i assume that it is a directory with files and instructions for installing TO the appropriate place. An installer will often prompt you for this. FWIW-mine is in /usr/lib and /usr/bin
So--is there a "README" or other documentation in that new folder?
|
|
|
06-01-2012, 09:26 AM
|
#6
|
Member
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215
Original Poster
Rep:
|
I have done the following:
1. Downloaded jre-7u4-linux-x64.tar.gz from oracle.com
2. Extracted it and changed my JAVA_HOME env variable to where I extracted it to: /home/myusername/java/jrel.7.0_04/
But when I now try to launch eclipse I still get the original error!!!
Any othere ideas??
Thanks for your help ..
|
|
|
06-01-2012, 09:33 AM
|
#7
|
Member
Registered: Jun 2012
Location: Missouri, USA
Posts: 236
Rep:
|
When you execute 'java -version' from the shell what did you get?
Also, can you tell us what GNU/Linux Distro is this? Maybe you need to export it to your PATH. Something like this:
Code:
export PATH=$PATH:/home/myusername/java/jrel.7.0_04/bin
|
|
|
06-01-2012, 09:40 AM
|
#8
|
Member
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215
Original Poster
Rep:
|
re: java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 2.3)
IBM J9 VM (build 2.3, J2RE 1.4.2 IBM J9 2.3 Linux amd64-64 j9vmxa64142ifx-20110628 (JIT enabled)
J9VM - 20110627_85693_LHdSMr
JIT - 20090210_1447ifx5_r8
GC - 200902_24)
re: what GNU/Linux Distro is this?
cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2
re: export PATH=$PATH:/home/myusername/java/jrel.7.0_04/bin
I did this and still the same error unfort
Thanks
|
|
|
06-01-2012, 10:05 AM
|
#9
|
LQ Newbie
Registered: Jan 2006
Location: Bel Air MD
Distribution: Fedora
Posts: 16
Rep:
|
Here is what I do:
First, you can use the tar/gz file, but I usually just get the binary and run it as root. I usually create a java directory in /usr unless I'm working with the production servers where sysops makes me put it in /usr/local. No big deal either way.
This is what I usually do.
Now that java stack is created, I've got one jdk1.6.0_24, path looks like this:
/usr/java/jdk1.6.0_24/all the java stuff in here
Create a symbolic link: /usr/java/jdk -> /usr/java/jdk1.6.0_24/
Create env variable in profile: JAVA_HOME=/usr/java/jdk
Add to path in profile $JAVA_HOME/jre/bin:$JAVA_HOME/bin
Now you've got java, javac, keytool, jps, etc. all working.
The jdk sym link is good because it simplifies updating your java. No one needs update their profile when updates are made, you just repoint sym link.
Regarding your question about default java.
Enter: which java
For me, using Fedora, I get back /usr/bin/java.
Do a "file" on that, and it shows that it is a symbolic link to the ootb java. After installing new java, I drop and reset that symbolic link to my new java location: JAVA_HOME/jre/bin/java
The good thing about doing this is that any user will run the same version since /usr/bin is usually automatically part of the path. If you want, create sym links in /usr/bin for javac as well, javaws, etc.
Last edited by dgodbey; 06-01-2012 at 10:06 AM.
|
|
|
06-01-2012, 10:07 AM
|
#10
|
Member
Registered: Jun 2012
Location: Missouri, USA
Posts: 236
Rep:
|
Quote:
Originally Posted by HarryBoy
re: java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 2.3)
IBM J9 VM (build 2.3, J2RE 1.4.2 IBM J9 2.3 Linux amd64-64 j9vmxa64142ifx-20110628 (JIT enabled)
J9VM - 20110627_85693_LHdSMr
JIT - 20090210_1447ifx5_r8
GC - 200902_24)
re: what GNU/Linux Distro is this?
cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 2
re: export PATH=$PATH:/home/myusername/java/jrel.7.0_04/bin
I did this and still the same error unfort
Thanks
|
So, you've added jre1.7.0_04/bin to your path and java -version still shows version 1.4.2? It should show 'java version "1.7.0_04"' instead.
Anyhow, if it is showing the new version then for some reason eclipse is still seeing the old java version. Can you try running eclipse with the '-vm' option specified on command line and see if it will work. Something like:
Code:
eclipse -vm /home/myusername/java/jrel.7.0_04/bin
|
|
|
06-01-2012, 10:16 AM
|
#11
|
Member
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215
Original Poster
Rep:
|
Ok I see that the old java path is in my PATH like so:
echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/home/myusername/java/jrel.7.0_04/bin
How do I remove this from my path??
Thanks
|
|
|
06-01-2012, 10:23 AM
|
#12
|
Member
Registered: Jun 2012
Location: Missouri, USA
Posts: 236
Rep:
|
Quote:
Originally Posted by HarryBoy
Ok I see that the old java path is in my PATH like so:
echo $PATH
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/home/myusername/java/jrel.7.0_04/bin
How do I remove this from my path??
Thanks
|
That would be something like this:
Code:
PATH=$(echo $PATH | sed -e 's#:/var/tmp/jre-7u4/jre1.7.0_04/bin/##')
replacing '/var/tmp/jre-7u4/jre1.7.0_04/bin/' with the actual path you want removed.
hope that helps
|
|
|
06-01-2012, 10:35 AM
|
#13
|
Member
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215
Original Poster
Rep:
|
re: PATH=$(echo $PATH | sed -e 's#:/usr/lib64/jvm/jre/bin/##')
The path did not get removed...
Thanks
|
|
|
06-01-2012, 10:39 AM
|
#14
|
Member
Registered: Jun 2012
Location: Missouri, USA
Posts: 236
Rep:
|
Quote:
Originally Posted by HarryBoy
re: PATH=$(echo $PATH | sed -e 's#:/usr/lib64/jvm/jre/bin/##')
The path did not get removed...
Thanks
|
Ohh, yes it did get removed here. Please take a look:
Code:
└─› echo $PATH_EXAMPLE
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/home/myusername/java/jrel.7.0_04/bin
└─› echo $PATH_EXAMPLE | sed -e 's#:/usr/lib64/jvm/jre/bin##'
/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin:/home/myusername/java/jrel.7.0_04/bin
|
|
|
06-01-2012, 10:46 AM
|
#15
|
Member
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215
Original Poster
Rep:
|
I'm not saying yours is not but mine is def not getting removed 
|
|
|
All times are GMT -5. The time now is 11:46 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|