I’m trying to learn java, and since I’m using ‘javac’ and ‘java’ all day, I’m using vim as my editor of choice. But I’m having a problem getting this system to work: I can’t even get a minimal “Hello World” program to run! Within vim, I can use :!javac % to compile the current file just fine. However, with a file Test.java, any attempt to call :!java Test yields an UnsupportedClasVersionError, even though the same command works fine outside of vim. I’m completely stumped.
I’m using java7 on windows 7 (64bit) with cmd.exe as my shell.
The Java you invoke is an older version than the Javac you invoke.
You most likely have a Java 6 JRE installed (for browser plugins etc) at system level and a Java 7 JDK installed which you’ve added at the end of your path.
Either tell Javac to produce Java 6 compatible class files (with
-target) or put the JDK in the front of your path.