Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Installing Java on Linux

 
Ravi Kanth D
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have downloaded the Java 2 SDK and the IDE combo package from Sun.com and have installed it. But strangely there was no info as to what class paths I need to set under Linux and how to do it? Can anyone plz help? Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to set the classpath; the default setting (none) is fine, at least at first. You will need to set your path so that your shell can find Java. Have a look at /usr/java/j2sdk1.4.2/ , or thereabouts. This should be your JDK install directory. Put ${JDK_HOME}/bin on your path; something like this in ~/.bashrc should be fine:

[ September 24, 2003: Message edited by: Ernest Friedman-Hill ]
 
Ravi Kanth D
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey...sorry....but I couldn' find that .bashrc file? Where exactly is it located...since you said I have to add the PATH thing to this code rt?
 
Ravi Kanth D
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would also aappreciate if you can give a little explanation on the code you have mentioned. I was wondering since in the first line we mentioned the location of Java in "JAVA_HOME"...do we also need to mention the same in the second line like this: PATH="${JAVA_HOME}/bin:${PATH}" ??
 
himanshu patel
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.bashrc is a hidden file.You will find in your home directory.
Since it is hidden file, you need to use command like this.
vi .bashrc
Essentially to view all hidden files in linux you have to prefix (.)
along with file name
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could be that .bashrc was not created. Then simply create such a file.
JAVA_HOME is the install directory for your SDK. The path must point to
the bin of the JAVA_HOME dir.
Explanation:
JAVA_HOME is read by some applications e.g. Apache, Ant to detect the home folder, to be able to find the JRE etc.
PATH: is processed by the shell to find the java commands (java, javaw, javac etc.)
This is why you have to set both. In Linux (also in Windows) your PATH variable is the search path for commands which aren't in the local directory. So when you are in a shell and type "cp" then the shell searches in all you path folders (in this case it would be /bin/)
[ September 24, 2003: Message edited by: Oliver Refle ]
 
Ravi Kanth D
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info...and my question is:
so in the second line of the code above...it should not be JDK_HOME....but it should be JAVA_HOME which was mentioned in the first line right?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAVA_HOME is the standard variable. There are also some tools
which require JDK_HOME (think netbeans IDE, but i am not sure).
Normaly when you start such a tool it will tell you it couldn't
find the desired variable.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

so in the second line of the code above...it should not be JDK_HOME....but it should be JAVA_HOME which was mentioned in the first line right?

Sorry, just being sloppy. I fixed my original post.
 
Ravi Kanth D
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw the .bashrc file and it doesn' have anything about PATH in it. On the other hand, there is a file bash_profile (I think) in my Home directory which has PATH mentioned in it. So do I add the above code to that bash_profile file then? Sorry...but being a starter in Linux everything seems so confusing rt now.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are several different startup files that bash can use -- both of those, plus several system-wide files in /etc.
The best thing to do is to say "info bash" at the prompt, then type
"gBash Startup Files" and press Enter; then read this section of the Bash manual which explains it all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic