• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New to Linux!!!

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
thanks.
 
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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.
 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go to http://java.sun.com/j2se/1.4.2/install-linux.html 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/j2sdk1.4.2
/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
/usr/local/mysql
Hope this helps, please post if you have more questions.
C
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The rpm usually puts it in /usr/java and you would run java from usr/java/bin
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 443
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?


Yes
 
Ravi Kanth D
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
JAVA_HOME=<path-to-jdk>
ANT_HOME=<path-to-ant>
XXX=YYYYY
export JAVA_HOME ANT_HOME XXX
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic