Hi
I've been using eclipse CDT for years I must now switch to java and installed the JDT version on Juno.
I first did a check with a classical HelloWorld program which works fine on my linux console
When I try to compile and run on eclipse I've got the error in the Problems window:
Archive for required library: '/usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/ext/gnome-java-bridge.jar' in project 'Hello World' cannot be read or is not a valid ZIP file Hello World Build path Build Path Problem
and if I run it nevertheless I've got on the console window:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: HelloWorld. Program will exit.
I'm new in java and I'm pretty sure it's something about the launch or(and) build configuration but the configuration options in JDT seems to me numerous and cryptic
When I followed for example the instructions from:
www.cis.upenn.edu/~matuszek/cit591-2004/Pages/starting-eclipse.html
to create a launch configuration it still gives me the exact same errors
the HelloWorld compiles and works fine within a linux shell console so it should not be a true error with the .jar file being invalid
Can anybody explain me my probably obvious newbee error ?
It looks like you installed something that put a Java extension in your jdk. The gnome-java-bridge.jar isn't a normal jar included in a JDK installation. Eclipse must have picked it up because it is in the lib/ext folder.
You can try removing it from the jre configuration. Go to Window->Preferences->Java->Installed JREs. Select the JRE you are using and edit it. Remove the entry for gnome-java-bridge.jar.
and it was in fact a bug of openjdk on some linux-opensuse systems:
the
/usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/lib/ext/gnome-java-bridge.jar
must be present on the system but in this release it is read forbidden for anybody but root (???)
just changing it's mode to rwx-r--r-- solved it
Thanks for the hint, it was trully a jar pb
PS: But I still don't understand why javac HelloWorld.java + java HelloWorld works and eclipse didn't want to compile run the same program ?