?
Solved

Export Path for Java at Linux

Posted on 2007-07-30
8
Medium Priority
?
1,595 Views
Last Modified: 2008-01-09
while compiling at linux, i always need to export the PATH of java/bin then compile.
i don't want to export for every session i want it to write at PATH variable, somthing like write to bash profile or somthing and it will be valid after reboot the pc too, what is the way to do?
0
Comment
Question by:marchent
  • 4
  • 3
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 19597898
add the export statement to your .bashrc file in home directory
0
 
LVL 13

Author Comment

by:marchent
ID: 19598316
how to add it?
0
 
LVL 92

Expert Comment

by:objects
ID: 19598329
its just a text file. It gets executed when u start a new sheel so just add any commends you want run each time
in your case

export PATH=......
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 13

Author Comment

by:marchent
ID: 19598367
i did export, but when i exit the shell, and open new one, i have to write export once again, i don't want to do again and again.
0
 
LVL 92

Expert Comment

by:objects
ID: 19598376
add the export command to your .bashrc file. That gets executed automatically
0
 
LVL 13

Author Comment

by:marchent
ID: 19598407
i added this line to .bashrc at /home directory
export PATH=/usr/java/j2sdk1.4.2_15/bin/:$PATH
but now working.
0
 
LVL 92

Accepted Solution

by:
objects earned 400 total points
ID: 19598438
> i added this line to .bashrc at /home directory

not /home, in the home directory of the user that you are logging in as
0
 
LVL 1

Assisted Solution

by:ashesh17
ashesh17 earned 100 total points
ID: 19606453
Hi merchent
try this
there should be a file java.sh in /etc/profile.d/
put following in that file.

JAVA_HOME="path to ur java instalation" e.g. "/usr/java/jdk1.5.0_06"
CLASSPATH=.:$JAVA_HOME/lib
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH

now type echo $JAVA_HOME it should return the path as you set.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question