I installed Java using .bin file. The folder i installed is JDK(/usr/lib/jdk1.6.0_29) and JRE(/usr/lib/jre1.6.0_29). I googled to set classpath but that things didn't work for me. Can any one suggest me commands using the folders that i mentioned above, to set classpath to execute a sample java program.

To set an environment variable you usually export it in your shell configuration file. For instance, in bash you would add an entry such as export CLASSPATH="/path/to/add:${CLASSPATH}" to your .bashrc . Other shells may require a different syntax.

It is hard to tell what problems you are having when you describe your failures as 'that things didn't work for me.' What have you tried? What effects have you noticed?

thanks for replying to the post. that things means the results from google.Java classpath setting is correct only but i couldn't execute java file. Now i solved it on my own.

====================================================================================
home]$ sudo /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.6.0-gcj/bin/java

Enter to keep the current selection[+], or type selection number:

Enter the number corresponding with the jre-1.6.0-openjdk and press enter.
3.
Repeat the process for --config javac.
==================================================================================

after executing the above lines i was able to execute java file also.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.