Question: When i am compiling like " javac Hello.java " .It compile file and when " java Hello " . Then it gives some message like "main class not found...." .So i am amazed that same things are working fine at one PC , and when i am trying to run in another PC, so get this error. I am not getting where is problem ?
As a general rule, you should not set a system classpath. You should set a classpath for each application.
[campbell@campbell-computer ~]$ echo $CLASSPATH
Note the blank for classpath. If you don’t specify a classpath, the Java runtime will use the “current directory”, also called . as its classpath. That is usually what you want. You would appear to have set a PATH in that bash file, which looks probably incorrect. What you have done is put the path to your wanted Java installation last in the path; if there are any other Java installations on your computer, they will be found first. If you want to use that JDK1.6.0_30 runtime, you would have to put it first in the path.
I think you would have to give us more detalis about the classpath on both those computers, the contents of the directories where those Hello classes are, and whether that Hello class contains a main() method.
subject: Setting Classpath of Java in Linux(RedHat-5)