LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2008, 11:23 AM   #1
kevintse
LQ Newbie
 
Registered: Mar 2008
Location: GZ China
Distribution: Fedora
Posts: 12

Rep: Reputation: 0
Why the JDK is installed automatically after I execute the .bin file?


I am a newbie, I am running a Red Hat Linux, I don't know how all this happened.
I have downloaded the JDK(jdk-6u5-linux-i586-rpm.bin) and executed it with "./", this action has generated several rpm files in the same folder as the .bin file, including "jdk-6u5-linux-i586.rpm", which I know from tutorials on the web should be executed with the "rpm" command to REALLY INSTALL the JDK, but the situation is different to me, when I tried to execute "rpm -ivh jdk-6u5-linux-i586.rpm", I was told the package was installed -- "package jdk-1.6.0_05-fcs is already installed", why this happened? and in which folder could I find the installed JDK?

please help, Thanks in advance.

Last edited by kevintse; 04-01-2008 at 01:07 AM.
 
Old 03-29-2008, 11:35 AM   #2
kevintse
LQ Newbie
 
Registered: Mar 2008
Location: GZ China
Distribution: Fedora
Posts: 12

Original Poster
Rep: Reputation: 0
Well, I have found that it is installed in /usr/java.

By the way, I forgot to ask another question. that is, after I execute "./jdk-6u5-linux-i586-rpm.bin", several files are generated, so what are these files?

sun-javadb-client-10.3.1-4.1.i386.rpm
sun-javadb-common-10.3.1-4.1.i386.rpm
sun-javadb-core-10.3.1-4.1.i386.rpm
sun-javadb-demo-10.3.1-4.1.i386.rpm
sun-javadb-docs-10.3.1-4.1.i386.rpm
sun-javadb-javadoc-10.3.1-4.1.i386.rpm
 
Old 03-29-2008, 12:17 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

The ".bin" file is just a convenience.

As you discovered, the JDK actually consists of several different packages (each package in its own separate .rpm). The ".bin" file just lets you install everything you need at once. No fuss, no hassle. Just easier to use.

Make sense?

PS:
You might actually have *several* different Java's on your system - the one you installed - and other versions you might not even be aware of.

You might want to try:
Quote:
rpm -qa | grep -i java
from the command line to check.

You can also run
Quote:
rpm -ql sun-javadb-client-10.3.1-4.1.i386.rpm | less
to examine any particular package in detail.

You should also be able to do this from the GUI (but I confess, I don't know which GUI might be most convenient for your particular version of RedHat).

'Hope that helps .. PSM

Last edited by paulsm4; 03-29-2008 at 12:24 PM.
 
Old 03-29-2008, 01:07 PM   #4
kevintse
LQ Newbie
 
Registered: Mar 2008
Location: GZ China
Distribution: Fedora
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you very much, paulsm.

I tried
Quote:
rpm -qa | grep -i java
,
and it showed me this:
Quote:
sun-javadb-client-10.3.1-4.1
glib-java-0.2.6-3.fc6
gcc-java-4.1.2-14.el5
bsh-javadoc-1.3.0-9jpp.1
java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.112
sun-javadb-common-10.3.1-4.1
sun-javadb-docs-10.3.1-4.1
java-1.4.2-gcj-compat-1.4.2.0-40jpp.112
java-1.4.2-gcj-compat-src-1.4.2.0-40jpp.112
sun-javadb-core-10.3.1-4.1
sun-javadb-javadoc-10.3.1-4.1
xmlrpc-javadoc-2.0.1-3jpp.1
sun-javadb-demo-10.3.1-4.1
does my system bring all this with it from scratch?

I tried this too

but it showed me this
Quote:
package sun-javadb-client-10.3.1-4.1.i386.rpm is not installed
is this package not installed? but it is in the list above?
By the way, what do all these files mean to me?
 
Old 03-29-2008, 01:59 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, again -

Apologies in advance that it's a bit confusing. Here's what's going on:

1. You downloaded and tried installing Java 6 from the Sun's Java web page. This is a Good Thing.

2. You executed the .bin to install Sun Java 6 on your Linux PC.
It apparently worked.
In an ideal world, you'd be done.

3. You noticed that the .bin appeared to contain several .rpm's.
This is true ... and it really shouldn't matter. The point is
that the ".bin" installed Java for you - all the components you
need, all at once. This, too, is a Good Thing.

4. Unfortunately, we don't know *where* the .bin installed your Sun Java yet.
Worse, we've discovered that there is also a different - incompatible - Java that came pre-installed on your system: Gnu Java.

5. Frankly, one thing you could do is to uninstall gjc (GNU Java). The one that's left should be your Sun Java, and everything should "just work".
Please consider this approach - it's not necessarily a bad idea.

6. But otherwise, read this article. It might answer some of your questions; it should suggest several good solutions:

http://www.ccl.net/cca/software/SOURCES/JAVA/JSDK-1.6/

7. Once you decide which way you want to go, please post back any questions/problems here to LQ.

8. In any case, please post back and let us know how it goes!

Thanx in advance .. PSM
 
Old 03-29-2008, 02:35 PM   #6
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
I would like to point out that uninstalling gcj is not necessary at all.
Copy this code into a file:
Code:
#! /bin/bash

/usr/sbin/update-alternatives --install /usr/bin/java  java  /usr/share/jdk1.6.0_03/bin/java 50
/usr/sbin/update-alternatives --install /usr/bin/javac  javac  /usr/share/jdk1.6.0_03/bin/javac 50
/usr/sbin/update-alternatives --install /usr/bin/jar  jar  /usr/share/jdk1.6.0_03/bin/jar 50
/usr/sbin/update-alternatives --install /usr/bin/appletviewer  appletviewer  /usr/share/jdk1.6.0_03/bin/appletviewer 50
/usr/sbin/update-alternatives --install /usr/bin/apt  apt  /usr/share/jdk1.6.0_03/bin/apt 50
/usr/sbin/update-alternatives --install /usr/bin/extcheck  extcheck  /usr/share/jdk1.6.0_03/bin/extcheck 50
/usr/sbin/update-alternatives --install /usr/bin/idlj  idlj  /usr/share/jdk1.6.0_03/bin/idlj 50
/usr/sbin/update-alternatives --install /usr/bin/jarsigner  jarsigner  /usr/share/jdk1.6.0_03/bin/jarsigner 50
/usr/sbin/update-alternatives --install /usr/bin/javadoc  javadoc  /usr/share/jdk1.6.0_03/bin/javadoc 50
/usr/sbin/update-alternatives --install /usr/bin/javah  javah  /usr/share/jdk1.6.0_03/bin/javah 50
/usr/sbin/update-alternatives --install /usr/bin/javap  javap  /usr/share/jdk1.6.0_03/bin/javap 50
/usr/sbin/update-alternatives --install /usr/bin/jconsole  jconsole  /usr/share/jdk1.6.0_03/bin/jconsole 50
/usr/sbin/update-alternatives --install /usr/bin/jdb  jdb  /usr/share/jdk1.6.0_03/bin/jdb 50
/usr/sbin/update-alternatives --install /usr/bin/jhat  jhat  /usr/share/jdk1.6.0_03/bin/jhat 50
/usr/sbin/update-alternatives --install /usr/bin/jinfo  jinfo  /usr/share/jdk1.6.0_03/bin/jinfo 50
/usr/sbin/update-alternatives --install /usr/bin/jmap  jmap  /usr/share/jdk1.6.0_03/bin/jmap 50
/usr/sbin/update-alternatives --install /usr/bin/jps  jps  /usr/share/jdk1.6.0_03/bin/jps 50
/usr/sbin/update-alternatives --install /usr/bin/jrunscript  jrunscript  /usr/share/jdk1.6.0_03/bin/jrunscript 50
/usr/sbin/update-alternatives --install /usr/bin/jsadebugd  jsadebugd  /usr/share/jdk1.6.0_03/bin/jsadebugd 50
/usr/sbin/update-alternatives --install /usr/bin/jstack  jstack  /usr/share/jdk1.6.0_03/bin/jstack 50
/usr/sbin/update-alternatives --install /usr/bin/jstat  jstat  /usr/share/jdk1.6.0_03/bin/jstat 50
/usr/sbin/update-alternatives --install /usr/bin/jstatd  jstatd  /usr/share/jdk1.6.0_03/bin/jstatd 50
/usr/sbin/update-alternatives --install /usr/bin/keytool  keytool  /usr/share/jdk1.6.0_03/bin/keytool 50
/usr/sbin/update-alternatives --install /usr/bin/native2ascii  native2ascii  /usr/share/jdk1.6.0_03/bin/native2ascii 50
/usr/sbin/update-alternatives --install /usr/bin/orbd  orbd  /usr/share/jdk1.6.0_03/bin/orbd 50
/usr/sbin/update-alternatives --install /usr/bin/pack200  pack200  /usr/share/jdk1.6.0_03/bin/pack200 50
/usr/sbin/update-alternatives --install /usr/bin/policytool  policytool  /usr/share/jdk1.6.0_03/bin/policytool 50
/usr/sbin/update-alternatives --install /usr/bin/rmic  rmic  /usr/share/jdk1.6.0_03/bin/rmic 50
/usr/sbin/update-alternatives --install /usr/bin/rmid  rmid  /usr/share/jdk1.6.0_03/bin/rmid 50
/usr/sbin/update-alternatives --install /usr/bin/rmiregistry  rmiregistry  /usr/share/jdk1.6.0_03/bin/rmiregistry 50
/usr/sbin/update-alternatives --install /usr/bin/schemagen  schemagen  /usr/share/jdk1.6.0_03/bin/schemagen 50
/usr/sbin/update-alternatives --install /usr/bin/serialver  serialver  /usr/share/jdk1.6.0_03/bin/serialver 50
/usr/sbin/update-alternatives --install /usr/bin/servertool  servertool  /usr/share/jdk1.6.0_03/bin/servertool 50
/usr/sbin/update-alternatives --install /usr/bin/tnameserv  tnameserv  /usr/share/jdk1.6.0_03/bin/tnameserv 50
/usr/sbin/update-alternatives --install /usr/bin/unpack200  unpack200  /usr/share/jdk1.6.0_03/bin/unpack200 50
/usr/sbin/update-alternatives --install /usr/bin/wsgen  wsgen  /usr/share/jdk1.6.0_03/bin/wsgen 50
/usr/sbin/update-alternatives --install /usr/bin/wsimport  wsimport  /usr/share/jdk1.6.0_03/bin/wsimport 50
/usr/sbin/update-alternatives --install /usr/bin/xjc  xjc  /usr/share/jdk1.6.0_03/bin/xjc 50
Verify that your jdk is really in /usr/share/jdk1.6.0_03. Not all distros put their jdks in the same place; on top of that, you may have a higher version than 1.6.0_03. Adjust as required. You may also need to change the priority (50 in the script above). 50 should be fine but if you add more jdks, you should set a different value for each of them.
Then make the file executable with chmod +x and execute it as root.

We are half there.

Install galternatives (the alternative is to do everything from the command line but that would be rather more work). Galternatives should appear on your menu; if not, you can launch from the command line with
galternatives
Look over the many items that relate to the jdk and select the sun jdk version for each. The items should match the items that are listed in the script I posted above.

If you now run java -version, you system will return jdk1.6.0 instead of gcj.

You may still need to set JAVA_HOME in your /etc/profile or ./bash_profile:
export JAVA_HOME=/path/to/jdk
export J2RE_HOME=/path/to/jdk/jre
export CLASSPATH=.:JAVA_HOME:JAVA_HOME/lib
You need to log out for these to take effect or use the "source" command.
Test with echo $JAVA_HOME; it should return the path to your JAVA_HOME.

By following this procedure, you can install as many jdks as you like. You can then set the one you need by using galternatives (or the update-alternatives --config java set of commands). You would also need to edit your (/etc/)profile.

Last edited by jay73; 03-30-2008 at 07:23 AM.
 
Old 03-29-2008, 03:13 PM   #7
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Please *don't* do that nonsense jay73 suggested unless you're *sure* the Java version you're installing happens to be the exact version in his post.

All that "update-alternatives" stuff should happen automatically during install (or update) ... but it's *extremely* error prone to deal with manually. I certainly wouldn't recommend it unless you know exactly what you're doing.

Please review this link:
http://www.ccl.net/cca/software/SOURCES/JAVA/JSDK-1.6/

Please decide what approach you feel most comfortable with (who knows - maybe you *prefer* a million "update-alternatives" commands?), and please post back with any questions.

IMHO .. PSM

Last edited by paulsm4; 03-29-2008 at 03:14 PM.
 
Old 03-29-2008, 04:47 PM   #8
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Quote:
Verify that your jdk is really in /usr/share/jdk1.6.0_03
Quote:
on top of that, you may have a higher version than 1.6.0_03. Adjust as required
Wasn't that clear enough then? But OK, yes, the compat package does essentially the same thing. I tend to prefer the manual way because jpackage clashes with Fedora in more ways than one.

Last edited by jay73; 03-29-2008 at 05:10 PM.
 
Old 03-30-2008, 07:17 AM   #9
kevintse
LQ Newbie
 
Registered: Mar 2008
Location: GZ China
Distribution: Fedora
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you all.

I read the article you suggested me reading, but actually I understood little, because there are so many commands I am not familiar with. so I think, before I become familiar with those commands, having the JDK working fine is enough to me for the moment.

After I set the environment variables, it works for command line complilation, and execution of Java program, and also for eclipse.

Thank you again!
LQ is a nice place for newbie like me.

I will bring questions with me when I come here next time.
 
  


Reply

Tags
jdk



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
/bin/basename: cannot execute binary file KasperLotus Linux - Software 7 02-14-2007 02:17 PM
How do I execute a .bin file? andi_kan Linux - Newbie 3 11-16-2005 08:15 AM
/bin/tar: cannot execute binary file dhammika Linux - General 8 11-08-2005 04:17 PM
Who can tell me why I am unable to execute bin file under RHEL AS 4? memorinex2005 Red Hat 7 03-10-2005 08:10 AM
New to Linux products, installed Linspire 4.5. How do you execute bin files flipthekilt Linux - Newbie 1 11-27-2004 12:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:56 AM.

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