LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-21-2002, 05:09 PM   #1
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Rep: Reputation: 15
Question Rpm Trouble Red Hat 7.3


I'm trying to install java on red hat 7.3

when I run j2sdk-1_3_1_03-linux-i386-rpm.bin, im asked to read an agreemnet, after I accept, the pakage gets extracted no problem. when I type rpm -iv jdk-1.3.1_03.i386.rpm, i get three error messages

error: cannot get exclusive lock on /var/lib/rpm/Packages
error: cannot open Packages index using db3 - Operation not permitted (1)
error: cannot open Packages database in /var/lib/rpm

although when I type rpm -iv jdk-1.3.1_03.i386.rpm in root, I get the message 'package jdk-1.3.1_03-fcs is already installed'.

when I type ls -la in the directory as root, I dont see any package like that installed, and when I try to compile a java application in that directory as root, I get the message 'javac: command not found'.

I'm new to Linux and Java and was following the tutorial from suns website on how to install java on linux. I also searched google for similar error messages but didnt understand any purposed solutions, besides everyone seemed to have a different answer. Im not sure what to do, like I said I'm new to the whole thing. If you have encountered this type of error and have solved it, I would love to know how.
thanks

P.S. I also have j2re-1_3_1_03-linux-i386-rpm.bin, do I need to open that and then run rpm on that first? I dont even know what j2re-1_3_1_03-linux-i386-rpm.bin is.
 
Old 09-22-2002, 12:25 AM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
try uninstall first

rpm -e packagename

if it says it's not installed then you should be able to install it

if you still can't do it use --force to install it
 
Old 09-22-2002, 01:39 AM   #3
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
JRE is Java Runtime Environment, if you don't want to program in Java it is the lesser way to make your system java aware - browser plugins, etc. If you want to create Java programs SDK (Software Development Kit) is the way to go.
 
Old 09-22-2002, 12:27 PM   #4
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Original Poster
Rep: Reputation: 15
Thanks guys
 
Old 09-22-2002, 06:06 PM   #5
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
To elaborate for your clearer understanding:

although when I type rpm -iv jdk-1.3.1_03.i386.rpm in root
Well done, not being root was the only thing causing those first few error messages.

when I type ls -la in the directory as root, I dont see any package like that installed
Well, ls only lists files in the directory. To see whether a package is installed, you use "rpm -q <package-name>". If you're not quite sure of a package's exact name (you'd have to have had correct case, etc), you can use "rpm -qa | grep -i <idea of part of name>". That pipes the output of rpm -qa which lists all installed packages (query all) into grep (searches for strings). grep will output any line from rpm -qa's output that contains the string you specify.
 
Old 09-22-2002, 11:12 PM   #6
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Original Poster
Rep: Reputation: 15
thanks for the advice faecal but when I search the package name

rpm -q jdk-1.3.1_3.i386.rpm in the directory as root, I get the message

package jdk-1.3.1_3.i386.rpm is not installed

so I typed the following

rpm -iv jdk-1.3.1_3.i386.rpm

and get the message

package jdk-1.3.1_3-fcs is already installed

so I tried

rpm -iv --force jdk-1.3.1_3.i386.rpm

and received the following

Preparing packages for installation...
(a few seconds go by)
jdk-1.3.1_3-fcs

so I tried to compile a program, not knowing if installing the package worked

javac Program.java

and get

javac: command not found

(I did all this as root)

Am I missing something?

Last edited by OrganicX; 09-23-2002 at 09:29 AM.
 
Old 09-23-2002, 03:34 AM   #7
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
It certainly does sound strange that the package is installed but javac isn't happening.

When you're referring to packages with the rpm command, the package name is just the first part, in this case simply "jdk", not the full filename. Another example would be xmms-devel-1.2.7-1.i386.rpm - the package name is just "xmms-devel".

I wouldn't recommend using force - if you want to install a newer version of a package over an older version, you can use rpm -U (upgrade) or if you want to install a package which is the same version as that which is already installed, you can use rpm -F (freshen).

Try "rpm -q jdk". If that spits back a version number, try "rpm -ql jdk" - that (query, list) will output a list of files that were installed by the package. See if javac is there. If it is, note its location, and try running it using the entire explicit path to javac. If that works, then the only remaining problem is that javac isn't on your path. "echo $PATH" will show you your path. Ask again if you need to know how to add something to your path.
 
Old 09-23-2002, 09:27 AM   #8
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Original Poster
Rep: Reputation: 15
thanks for all you help faecal, I tried

rpm -ql jdk

and It spit back a lot of paths so I did

rpm -ql jdk | more

and looked for javac

I found the following with the word javac.

/usr/java/jdk1.3.1_03/bin/i386/green_threads/javac
/usr/java/jdk1.3.1_03/bin/i386/native_threads/javac
/usr/java/jdk1.3.1_03/bin/i386/native_threads/oldjavac
/usr/java/jdk1.3.1_03/bin/javac
/usr/java/jdk1.3.1_03/bin/oldjavac
/usr/java/jdk1.3.1_03/jre/bin/i386/green_threads/javac
/usr/java/jdk1.3.1_03/jre/bin/i386/green_threads/oldjavac
/usr/java/jdk1.3.1_03/man/ja_JP.eucJP/man1/javac.1
/usr/java/jdk1.3.1_03/man/man1/javac.1

so Im assuming I do have a javac file

so them I typed pwd to confirme where I was and I was in

/tmp (the same directory where i tried to compile my code and this is the same directory where the jdk package is located)

Am I trying to compile my code in the wrong directory?
should I be writing and compileing my code in the /usr directory or some other directory in the /usr directory or am I completely off the mark?

this may be related or not but when Im in the /usr directory and type

ls

I see a java directory (as seen in the paths above). so I did an ls -l to make sure and, yes there is a java directory so I tried

cd /java (as both root and a regular user)

and got the same message as both users

cd: /java: No such file or directory

is this related to my problem or does all this have nothing to do with my problem?


Last edited by OrganicX; 09-23-2002 at 09:33 AM.
 
Old 09-23-2002, 09:41 AM   #9
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
cd /java and cd java have very different meanings! That slash at the start makes bash think that you're looking for the folder at the base of the directory tree. You might type "cd /usr" and then "cd java", or just "cd /usr/java".

Getting back to your problem...

/usr/java/jdk1.3.1_03/bin/javac - this is our baby! What you need to do is add the /usr/java/jdk1.3.1_03/bin/ directory to the list of paths that the shell searches when it's looking for an executable.

If I type "blarg" (or some other nonsense) at my prompt, bash will search through directories such as /usr/bin, /bin, ~/bin looking for a file of that name to execute. Doesn't find it in any of the directories it knows about, so it gives me an error.

bash's information about where to find executables is stored in an environment variable called PATH. To see what your path is at present, you can type "echo $PATH". To add a directory to your path, you can type "PATH=$PATH:<your directory>", so you'd type "PATH=$PATH:/usr/java/jdk1.3.1_03/bin/". After doing that, you'd find that you could just type "javac" at the prompt, and bash would find an execute it.

The caveat is that your PATH is reset every time you logoff. To make your setting persistant, you can add your "PATH=$PATH:/usr/java/jdk1.3.1_03/bin/" to the .bashrc file in your /home/<user name> directory.

Once the path is set up properly, you can work on your code whereever you like. Not in the /usr directory! To access that you need to be logged on as root, and one should always used one's system as a regular user, to decrease your security vulnerability. Only use root when you need to do something that only root can do. Just create yourself a ~/java directory or something (~ is the symbol that means your home directory).
 
Old 09-23-2002, 11:18 AM   #10
OrganicX
Member
 
Registered: Aug 2002
Posts: 105

Original Poster
Rep: Reputation: 15
Thumbs up

IT WORKS!!

Faecal, you solved my problem. I followed your instructions and now I can write, compile and view the results of my programs. I even modified .bashrc as you said and rebooted and it still works. Im so happy, thank you, thank you, thank you!!


Last edited by OrganicX; 09-23-2002 at 11:19 AM.
 
Old 09-23-2002, 03:02 PM   #11
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
also you may do this

I think it should be that way



ln -s /usr/java/jdk1.3.1_03/bin/javac /bin/javac



this creates a link in /bin
 
Old 09-24-2002, 06:29 AM   #12
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
DavidPhillips: mmm, using a symlink occurred to me, but I decided to play safe and recommend putting it in the path - I'm not familar with the java SDK, so I didn't know if other binaries might be needed. Fair point though, it does get a bit silly if you're putting every installed program's directory in PATH.

OrganicX: No problem :-)
 
  


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
Having Trouble installing red hat 8 Troubledyouth Linux - Software 14 07-10-2005 08:52 PM
trouble installing Red hat SurfCHimp Linux - Software 2 01-24-2005 01:35 PM
trouble with red hat 7 installation! hakim Linux - Newbie 1 05-23-2004 08:55 PM
rpm help Red Hat 9. ThrustMaster Linux - Newbie 2 03-20-2004 04:06 PM
Red Hat 9 and LAN trouble capetech Linux - Networking 9 08-21-2003 06:26 PM


All times are GMT -5. The time now is 12:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration