0

I'm new in java and faced aproblem in PATH . I want to set classpath of java and want someone to review what i did to know what's the exact problem

java -version

java version "1.6.0_38"
JAVA(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java Hotspot(TM) Client VM (build 20.13-b02,mixed mode, sharing)

javac -version

javac 1.6.0_38

whereis java

/usr/bin/java  /etc/java  /usr/bin/X11/java   /usr/share/java

which java

/usr/bin/java

echo $CLASSPATH

empty 

i edited in /etc/profile this

JAVA_HOME=/usr/lib/jvm/jdk1.6.0_38
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

and i edited in .bashrc this

PATH=/usr/lib/jvm/jdk1.6.0_38/bin:$PATH
export PATH

I'm on ubuntu12.04

  • possible Duplicate : http://stackoverflow.com/questions/1975684/setting-up-java-classpath-and-java-home-correctly-in-ubuntu – santhosh Oct 01 '14 at 06:30
  • everyone has own setting and i think is not duplicate –  Oct 01 '14 at 06:39
  • A Question should contain an actual question, and this one doesn't. Hint: "please review this" is NOT a question. Hint 2: if you your current settings are not working, you need to explain what the symptoms are. – Stephen C Oct 01 '14 at 07:21
  • i explained it by echo #CLASSPATH is empty and post all my setting that help anyone have the knowledge to solve it –  Oct 01 '14 at 07:23
  • Why do you “Need to set `CLASSPATH`”? Java itself doesn’t need it. And since you have accepted an answer which makes no sense, it seems you have a working environment, even if the contents of the `CLASSPATH` is nonsense. Just a small hint: don’t trust twenty year old tutorials. – Holger Oct 01 '14 at 08:13

1 Answers1

0

If you want to set CLASSPATH for java, DO :

  1. Update .bashrc(sudo gedit $HOME/.bashrc)

         export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_38
         export PATH=$PATH:$JAVA_HOME/bin
         export CLASSPATH=$JAVA_HOME/bin  
    
  2. now run this command to apply changes to .bashrc(source $HOME/.bashrc).close the terminal.

  3. reopen the terminal
Ashay Patil
  • 152
  • 4
  • i'll try it now but am i delete the commands in /etc/profile or not ? –  Oct 01 '14 at 06:40
  • i tried your command sudo source $HOME/.bashrc but i got source : command not found –  Oct 01 '14 at 06:45
  • Sorry,there is no need to write sudo ...just write (source .bashrc) – Ashay Patil Oct 01 '14 at 06:53
  • Thanks for helping . i want to set CLASSPATH also because i echo $CLASSPATH and got empty ! –  Oct 01 '14 at 06:59
  • you want CLASSPATH=/usr/lib/jvm/jdk1.6.0_38/bin....am i right?...if yes then add in bashrc (export CLASSPATH=$JAVA_HOME/bin) – Ashay Patil Oct 01 '14 at 07:01
  • yes but how can i write it export CLASSPATH or what ? –  Oct 01 '14 at 07:03
  • i tried it but still empty when i used (echo $CLASSPATH) –  Oct 01 '14 at 07:10
  • have you run (source .bashrc) after updating .bashrc? also reopen terminal – Ashay Patil Oct 01 '14 at 07:15
  • yes i found it . sorry i didn't open new terminal +1 and accept answer –  Oct 01 '14 at 07:18
  • That will set `CLASSPATH` to the bin/ directory of the jdk, so it’s not empty, but it doesn’t make the slightest sense. In that directory are no classes. – Holger Oct 01 '14 at 08:09