Hi guys ,
This is the first time i m running java application inside linux.
i have installed jdk-6u20-linux-i586-rpm.bin jre-6u20-linux-i586-rpm.bin in my linux machine.
and set JAVA_HOME and JRE_HOME variables respectively.
# echo $JAVA_HOME
/usr/java/jdk1.6.0_20/
# echo $JRE_HOME
/usr/java/jre1.6.0_20/
I have created a little java program helloworld.java
class helloworld{
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
I m able to compile the program by doing javac helloworld.java
but not able to run the program by doing java helloworld.
It is giving me following error.
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException: helloworld not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/java/jdk1.6.0_20/bin/], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
whenever i type java in command prompt it give me following output. M i missing anything.
# java
Usage: gij [OPTION] ... CLASS [ARGS] ...
to invoke CLASS.main, or
gij -jar [OPTION] ... JARFILE [ARGS] ...
to execute a jar file
Try `gij --help' for more information.
I think /usr/bin/java is not poited to /usr/java/jdk1.6.0_20/bin/java
It is pointed to some other java (which i m not sure).
How do i change this pointing?
If i do the changes will it have any serious impact ?