LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 05-06-2010, 06:23 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Rep: Reputation: 36
What is the difference between GCJ and jre?


I was trying to install jdk and jre latest version on my linux machine .

Oracle enterprise linux

However after successful install of jdk and jre i came across a strange thing that whenever i used to fire java -version
i used to get following output
Quote:
java
Usage: gij [OPTION] ... CLASS [ARGS] ...
to invoke CLASS.main, or
gij -jar [OPTION] ... JARFILE [ARGS] ...
to execute a jar file
Try `gij --help' for more information.
But after few tweaking into my system i somehow managed to get the latest java running.

But now i m confused what was the previous output referring to and why was it there?
 
Old 05-06-2010, 07:23 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,145

Rep: Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642
The default installed java is the "gcc - java".
( Please Google it for more information.)


The easy "setting up solution" :
su
Code:
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_20/bin/java 2
And then you can do :
/usr/sbin/alternatives --config java
........ and choose '2'.

'javac' seems to be set up at the rpm package install.
http://www.linuxquestions.org/questi...8/#post3959048
java -version
javac -version
..

Last edited by knudfl; 05-06-2010 at 07:35 AM.
 
1 members found this post helpful.
Old 05-06-2010, 07:34 AM   #3
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
gij - GNU interpreter for Java

This comes default with EL.
Put your newly installed java before the path of gij.
 
Old 05-07-2010, 12:51 AM   #4
pinga123
Member
 
Registered: Sep 2009
Posts: 676
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by knudfl View Post
The default installed java is the "gcc - java".
( Please Google it for more information.)


The easy "setting up solution" :
su
Code:
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_20/bin/java 2
And then you can do :
/usr/sbin/alternatives --config java
........ and choose '2'.

'javac' seems to be set up at the rpm package install.
http://www.linuxquestions.org/questi...8/#post3959048
java -version
javac -version
..
Thank you very much for you reply .

Here is what i had done before reading you post.
i have fired "which java" command.

from the output i have got the location of java file
i changed the java file location from /usr/bin
to /usr/bin/javabackup (created new folder named javabackup).
added /usr/java/jdk<versionname>/bin to path using.
export PATH=$PATH:/usr/java/jdk1.6.0_20/bin/

Is there any thing wrong into it?
Code:
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_20/bin/java 2
Can u please give solution to some of my queries.
1)What does /usr/sbin/alternatives does?
2)Is it distribution specific or for different distribution there is a different way of setting it?
3)What is the significance of 2 after /usr/java/jdk1.6.0_20/bin/java?
 
Old 05-07-2010, 12:55 AM   #5
ajeetsinghraina
Member
 
Registered: May 2010
Location: India
Distribution: Ubuntu 7.04/8.04/8.10/10.04, RHEL 6, OpenSUSE,Mandriva,Fedora, CentOS, XandrOS, Slackware, OpenSolar
Posts: 155

Rep: Reputation: 55
Reconfiguring the default Java configuration for Red Hat / Fedora

This is done as root or equivalent.

First remove /var/lib/alternatives/java file by typing;

rm /var/lib/alternatives/java

When asked press the 'y' key,

Now to create the new (corrected) alternatives file for java type
the following commands as root (modify for jdk as needed);

/usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.4.2-gcj/bin/java 1

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 2

/usr/sbin/alternatives --config java

You should now see for example:

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/java/jre1.6.0/bin/java

Enter to keep the current selection[+], or type selection number:

Type: <choose 1 or 2>

In the example above java is already configured correctly [*+ 2] to
use Sun's Java, no changes are needed, just press the Enter key here.
If you have been following the instructions then you should have
the same results (version numbers may be sightly different).

Now type; /usr/sbin/alternatives --display java

You should see for example;

java - status is manual.
link currently points to /usr/java/j2re1.5.0_09/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1
/usr/java/jre1.6.0/bin/java - priority 2
Current `best' version is /usr/java/jre1.6.0/bin/java.

Next you might want to create (or edit) /etc/profile.d/java.sh
file, example below;

export JAVA_HOME="/usr/java/jre1.6.0/bin/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"

When done creating or editing the file type;

source /etc/profile.d/java.sh

Now any user root or other wise should be able to use the command;

which java

and the results should read something like;

/usr/bin/java

Also any user root or other wize should be able to use the command;

java -version

and the results should read something like;

java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

That's it, all done.
 
Old 05-07-2010, 03:52 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,145

Rep: Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642Reputation: 2642
"" 1) What does /usr/sbin/alternatives do ?""
→ makes an entry into /etc/alternatives .

"" 2) Is it distribution specific or.. ""
→ Not all 'Linux OS' have /etc/alternatives .

"" 3) What is the significance of 2 ......""
→ An ID for this entry. With 2...4 java installed,
it's a way of indexing them in /etc/alternatives.

The export command, (post #4) is temporary, is valid
for one terminal session only. When you exit the
terminal the temporary path exported exist no more.

I would never set a java path ! When the right java
is present in /usr/bin/ , everything will usually work.
The "/etc/alternative/ system" takes care of that :
A link by name 'java' in /usr/bin/ .
..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Sun JRE versus GNU JRE frznchckn Linux - Software 3 05-19-2009 01:18 PM
Limewire issue... Sun Jre conflicts with gcj? Or something else... hans21 Linux - Software 6 11-27-2006 11:20 AM
gcj instead of Sun's JRE. Good or bad? Mega Man X General 10 06-29-2006 01:57 PM
convert from jre-...-rpm.bin into jre-...rpm gimi_k2 Linux - Newbie 3 07-18-2005 07:34 PM


All times are GMT -5. The time now is 11:24 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration