LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   setting path for java (https://www.linuxquestions.org/questions/programming-9/setting-path-for-java-51577/)

ahernaiz 03-24-2003 10:50 PM

setting path for java
 
hi, im new to linux and i need java. i downloaded the new java sdk and installed it with no problems but I need to set paths in order to be able to compile and run my files. I have no clue how to do this. Any help would be greatly appreciated.

mayankjohri 03-24-2003 11:20 PM

there is a file called $HOME/.bash_profile
u can add the path of java there

nakkaya 03-24-2003 11:32 PM

1)

* Create a download directory:
*

mkdir $HOME/archive

2)

* Download J2SE 1.4.1 sdk RPM to your archive directory. Get the SDK here.
* The file is called: j2sdk-1_4_1_01-linux-i586-rpm.bin
* This script is not executable, therefore type:
*

chmod a+x j2sdk-1_4_1_01-linux-i586-rpm.bin

*

./j2sdk-1_4_1_01-linux-i586-rpm.bin

* Than agree to the licensing terms.

3)

* Note that your archive directory now contains a new file called: j2sdk-1_4_1_01-fcs-linux-i586.rpm
* Install the SDK. Type: su (and enter super user password).
*

rpm -ivh j2sdk-1_4_1_01-fcs-linux-i586.rpm

* The SDK is now installed however there are still a few configuration tasks.
* This is where most people have trouble.

4)

* Linking the plugin to Mozilla and Galeon (Galeon uses Mozilla plugins).
* We should still be in super user mode. If not than become super user again: su (password).
*

ln -s /usr/java/j2sdk1.4.1_01/jre/plugin/i386/ns610/libjavaplugin_oji.so /usr/lib/mozilla-1.1/plugins/

* Now your browers (Mozilla and Galeon) will display Java2 1.4.1 websites.
* Exit as super user. Type: exit

5)

* Configuring the executable PATH.
* In regular user mode.
*

emacs $HOME/.bash_profile

* At the very bottom of the file add the line:
*

export PATH=/usr/java/j2sdk1.4.1_01/bin:$PATH

* Exit emacs by holding down Ctrl and pressing x than s than x than c.
*

Ctrl - x - s - x - c

* Now log out and log back in, so that the settings to take effect.

6)

* Test the configuration of the executable PATH. Simply type:
*

javac

* You should see a list of the java compiler command switches.
* Find a tutorial or book and write some Java2 programs.
* If you have problems you can mail

* Note: If you have a backup file (ls -al $HOME) called .bash_profile~ in addition
* to your new .bash_profile (without the ~), than delete the backup (rm ./.bash_profile~)
* Than try loging back in and everything should work. For some reason the backup file
* overrides the new script.

real adress for the tutorial http://members.shaw.ca/trollking/linux.html

Hangdog42 03-25-2003 08:08 AM

You can also modify the PATH in /etc/profile so that all users can see java, not just those that have modified .bash_profile

ahernaiz 03-25-2003 04:30 PM

thanks to everyone


All times are GMT -5. The time now is 03:09 AM.