The file you need to run should end .class or .jar. If you don't have such a file, you'll need to compile it first. You probably need a java sdk rather than jre, although gcj might do the trick.

Then:
 javac Switch.java
should make the .class file. (You may need to include the path to your java compiler).

Finally:
 java Switch.class
should run it.

Of course Switch may not be a runnable class, in which case you'll get an error.

Kevin

yang li wrote:
Hi,
I have a java program named Switch.java, I want to run it under fedora5 core, I donnot know any compiler I need to install? I installed a package named jre-1_5_0_11-linux-i586-rpm.bin, when I use command
  java Switch.java
wrong information came out:
Exception in thread "main" java.lang.NoClassDefFoundError: SwitchI
   at gnu.java.lang.MainThread.run(libgcj.so.7)
Caused by: java.lang.ClassNotFoundException: SwitchI not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.7)
   at java.lang.ClassLoader.loadClass(libgcj.so.7 )
   at java.lang.ClassLoader.loadClass(libgcj.so.7)
   at java.lang.Class.forName(libgcj.so.7)
   at gnu.java.lang.MainThread.run(libgcj.so.7)

Then I used command yum install libgcj.so.7 , but it was not helpful.
I am a java newhand, any help will be appreciated, thanks!

Reply via email to