This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes New to Linux!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "New to Linux!!!" Watch "New to Linux!!!" New topic

New to Linux!!!

Brian Smith
Ranch Hand

Joined: Oct 26, 2002
Posts: 232
hi folks,
i am new to linux environment. i trying to install java in it but i am wondering which of its(linux) folder is used to install software and other stuffs that user wants to store. can you please advise me with explanations?
Alton Hernandez
Ranch Hand

Joined: May 30, 2003
Posts: 443
It depends on the file that you will download. If you download the rpm, it will probably have a pre-defined installation directory. If you download the tar file, you can control where you want it installed. In my case, I actually downloaded the tar file.
In my opinion, it really doesn't matter where you will install Java. In my case, I don't have enough space in any of my ext2 partitions, so I installed it in my windows partition. What is important is that the path is properly set so that when you compile and execute a program, the system can find Java's executables and libraries.
Hope this helps.
Chintan Rajyaguru
Ranch Hand

Joined: Aug 19, 2001
Posts: 341
Go to This link has detailed instructions to install J2SDK version 1.4.2. You oculd find a similar link if you are going to install another version. Since you mentioned that you are new to linux, let me try to explain something to you. In windows, when you try to install an exe it defaults to some folder in program files folder during installation. Installing an RPM file is something (very remotely) similar. As the previous user said, RPM comes with predefined folders. So if you follow installation instructions in the link above and use RPM file, it will install itself to a proper folder. I believe it will get installed in /usr/local directory. However, please note that in most cases you need administrative access to install RPM (you need to know password of the user "root").
Now, every user in linux has his/her own home directory in which is located at /home/username. So, if you had two users namaste and sathi, both will have their own home directories in /home/namaste and /home/sathi. Each user has all rights within his own directory (he can download and install stuff in his directory). If you do not have root access, you could download binary distribution of j2sdk in your /home/namaste (or whatever it is) and install it there (see instructions to install binary version of j2sdk in the link above). Since only namaste has access to /home/namaste directory, only this user can read, write and execute files in this directory (unless you change permissions).
In a nut shell, if you have root access and if you want more than one users to access j2sdk, it is recommended that you install it in a high level directory (such as /usr/local) and set permissions so that more than one users can use the files. If you have root access, you can install both binary and rpm versions in this directory. Alternatively if you want only one user to access files, it is recommended that you install files in /home/username directory (no need to set permissions).
In my case, I am the only user on my linux distro and I try to install everything in my home directory. So I have directories like
/home/chintan/eclipse (eclipse installation)
/home/chintan/JBoss (Jboss app server installation)
I wanted mysql database to be available system wide (to every user that I might create in future) so I installed mysql in
Hope this helps, please post if you have more questions.
C - Coming soon!
RJ Espinoza

Joined: Jan 10, 2003
Posts: 12
The rpm usually puts it in /usr/java and you would run java from usr/java/bin
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Either /usr or /var are most used to install software into.
Sometimes /opt is an option (pun intended).
Can never remember which is the preferred way, I think it used to be /usr but is now /opt or /var

Alton Hernandez
Ranch Hand

Joined: May 30, 2003
Posts: 443
You can refer to the Filesystem Hierarchy Standard document if you wanted to know where is the right place to install Java. Based on that document, the choices are either /usr or /opt.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

I like to consider /opt as the "Program Files" directory of Linux. Which is to say that vendor-type apps usually fit well there (things like WebSphere, office suites, etc). By convention, the application top-level directory would identify the manufacturer or major product. More informal apps usually go into /usr, and generally into /usr/local (for example, /usr/local/jboss).
Java is a little unusual in that a common place to find it is /usr/java/<release>

An IDE is no substitute for an Intelligent Developer.
Ravi Kanth D

Joined: Sep 14, 2003
Posts: 18
I have installed Java using rpm package(I used su to login as root from my current user login Ravi). It installed in /usr/Java. Now I found that there is an IDE combo package so I installed that again....using same root privileges...and this time it installed in /opt. My questions are:
1) How to uninstall the first installation without affecting the second one
2) Can the second installation be accessed by other users?
I am relatively new to Linux so would appreciate the help. Thanks.
Idly Vada
Ranch Hand

Joined: Sep 02, 2003
Posts: 135
1) How to uninstall the first installation without affecting the second one.

use -e option with rpm command.
For example: if the jave rpm you installed is j2sdk-1_4_1_02-linux-i586-rpm
then use the command
rpm -ev j2sdk-1_4_1_02-linux-i586-rpm
You can use command rpm -q j2sdk-1_4_1_02-linux-i586-rpm to check whether it is installed or not.
For more info use man page of rpm command using
man rpm

2) Can the second installation be accessed by other users?

Ravi Kanth D

Joined: Sep 14, 2003
Posts: 18
It looks like I have installed Java...but I could find no info as to how to set class paths in Linux. Can someone tell me what exactly do I need to do in order to get the installed Java to work on Red Hat Linux 9? Thanks.
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
since you use rpm, I can only assume u use Redhat or Mandrake. In linux/unix, CLASSPATH, JAVA_HOME are called environmnt variables, there are several to set this.
1. Set it as global (every user will have these variables to them)
-> I havn't use redhat for awhile now, as far as I remember, there should a file call profile under /etc directory, log in as root, edit the file:
2. Set it as local (only the particular user will have them)
-> If you are using bash shell (echo $SHELL to check). you can add to your .bash_profile file
Add these lines:
I agree. Here's the link:
subject: New to Linux!!!
jQuery in Action, 3rd edition