LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 06-01-2012, 08:55 AM   #1
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Rep: Reputation: 16
How to Install java


I have downloaded:

jdk-7u4-linux-x64.tar.gx.

How do I install this???
 
Old 06-01-2012, 09:02 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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?
 
Old 06-01-2012, 09:09 AM   #3
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
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??
 
Old 06-01-2012, 09:18 AM   #4
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 236

Rep: Reputation: 64
Quote:
Originally Posted by HarryBoy View Post
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.
 
Old 06-01-2012, 09:18 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by HarryBoy View Post
.....

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?
 
Old 06-01-2012, 09:26 AM   #6
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
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 ..
 
Old 06-01-2012, 09:33 AM   #7
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 236

Rep: Reputation: 64
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
 
Old 06-01-2012, 09:40 AM   #8
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
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
 
Old 06-01-2012, 10:05 AM   #9
dgodbey
LQ Newbie
 
Registered: Jan 2006
Location: Bel Air MD
Distribution: Fedora
Posts: 16

Rep: Reputation: 1
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.
 
Old 06-01-2012, 10:07 AM   #10
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 236

Rep: Reputation: 64
Quote:
Originally Posted by HarryBoy View Post
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
 
Old 06-01-2012, 10:16 AM   #11
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
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
 
Old 06-01-2012, 10:23 AM   #12
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 236

Rep: Reputation: 64
Quote:
Originally Posted by HarryBoy View Post
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
 
Old 06-01-2012, 10:35 AM   #13
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
re: PATH=$(echo $PATH | sed -e 's#:/usr/lib64/jvm/jre/bin/##')

The path did not get removed...

Thanks
 
Old 06-01-2012, 10:39 AM   #14
rosehosting.com
Member
 
Registered: Jun 2012
Location: Missouri, USA
Posts: 236

Rep: Reputation: 64
Quote:
Originally Posted by HarryBoy View Post
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
 
Old 06-01-2012, 10:46 AM   #15
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
I'm not saying yours is not but mine is def not getting removed
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Java Woes: A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available ... chytraeus Slackware 10 11-27-2010 10:04 AM
Created USB bootable Ubuntu persistent install Cant install Java murph98 Linux - Newbie 3 05-26-2008 07:09 AM
I am trying to install Java on Ubuntu. How to install it? ussr_1991 Linux - Software 4 07-24-2007 01:50 PM
java does not install in opt but install in usr bbmak Linux - Software 6 10-02-2005 11:13 PM
what directory is java install? what CMD determined where java is install? Thks. suse2166 Linux - Newbie 2 09-04-2005 08:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration