As an attempt to solve my JUnit problem, I've uninstalled the Java5 and Java6 JREs from my computer, and installed the GCJ JRE. This has had the funny consequence of completely screwing up Eclipse. This happens when running an Eclipse-built class from either Eclipse or using command-line java (or junit, for :
Exception in thread "main" java.lang.ClassFormatError: Entry (unrecognized class file version) at java.lang.VMClassLoader.defineClass(libgcj.so.70) at java.lang.ClassLoader.defineClass(libgcj.so.70) at java.security.SecureClassLoader.defineClass(libgcj.so.70) at java.net.URLClassLoader.findClass(libgcj.so.70) at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.70) at java.lang.ClassLoader.loadClass(libgcj.so.70) at java.lang.ClassLoader.loadClass(libgcj.so.70) at gnu.java.lang.MainThread.run(libgcj.so.70)
However, I notice that compiling programs with command-line javac and then running them with java or Eclipse, works without any apparent problem. A quick comparison of files generated by Eclipse on the one hand and javac on the other hand yield:
bin/Correct.class: compiled Java class data, version 46.0bin/Incorrect.class: compiled Java class data, version 50.0
So, it does appear that there's a version difference. However, the only JRE I find in the Eclipse properties or the eclipse properties is the GCJ one. Actually, it's the only JRE (and compiler) available on my system:
/usr/bin/javac/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/bin/javac/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/man/man1/javac.1.gz
Which means that Eclipse is somehow using the GCJ javac to generate an output which is incompatible with command line use of javac, and also incompatible with the entire GCJ virtual machine!
I'm a bit lost here... Any simple way of bonking Eclipse on the head, so that it uses javac correctly? Any places where I might have screwed up and asked for an incorrect file version?