• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

how to set up java in linux?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jdk1.5.0_05 is in /opt
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

I'm going to move this question to our Linux/UNIX forum.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main thing you need to do is set the PATH variable for your user. You can do this by modifying a file in your users directory. The exact file name depends on which shell you use. For example, if you are using bash, then open ~/.bashrc in your favorite text editor and add the following line at the end:

PATH=$PATH:/opt/jdk1.5.0_05/bin

Then the next time you open a terminal, you can just type commands like "javac" and "java" to compile and run your own Java programs.

HTH

Layne
 
Bartender
Posts: 1078
19
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Even better, download the J2SE SDK with NetBeansIDE Bundle. Then install via the install program.
[ October 09, 2005: Message edited by: Peter Rooke ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Peter Rooke:


Even better, download the J2SE SDK with NetBeansIDE Bundle. Then install via the install program.

[ October 09, 2005: Message edited by: Peter Rooke ]



Personally, I would recommend leaving out the CLASSPATH variable. The defaults without this variable are just fine for a beginner.

Layne
 
Edgardo Lara
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created java.sh under /etc/profile.d

which contain the ff:

export JAVA_HOME=/opt/jdk1.5.0_05
export PATH=$PATH:$JAVA_HOME/bin

It successfully run a Sample.java

my follow up question is:

1. why the version is still java version "1.4.2"?
2. where is the preferable location of the jdk? is it in /opt OR /usr/local? any difference?
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) because there is a second (a first) JDK (at least jre) installed, and this is found first in the path.

find out where it is with .

2) There is no preference from java, there is no preference for linux.
If you don't have preferences - there is no.

My preference is to install JDKs to opt like this:


If there is a new jdk-1.5.1, I may install it there too, link jdk-1.5 to new version and keep the old for sure.

JAVA_HOME is allways /opt/java.
No fiddling with the path is needed.
Switching between 1.4 and 1.5 was easy (but is rarely used the last months).
 
Screaming fools! It's nothing more than a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic