0

I'm trying out Bash on Ubuntu on Windows. I have a simple program:

`class Hello
    {
        public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}`

I have Java version 8u102 on Windows and 7u111 on the Windows Subsystem for Linux. The program compiles and runs fine on Windows. The program compiles on the Subsystem but when I try to run it, I get this error:

Exception in thread "main" java.lang.unsupportedClassVersionError: Hello: unsupported major.minor version 52.0

How do I get Java programs to run on the Windows Subsystem for Linux?

  • 2
    Compile with Java 7. You are currently compiling with Java 8, and trying to run it with Java 7. – Elliott Frisch Sep 14 '16 at 03:29
  • But when I run `javac -version` I see that it's 7u111. – jessikacoh Sep 14 '16 at 22:50
  • For future reference: the duplicate doesn't really seem to address the underlying cause of the OPs issue. My guess is that the OP didn't realize that `javac` won't recompile files that already seem to be compiled, so although they thought they had recompiled the program with Java 7 some or all of the class files were in fact still Java 8. – Harry Johnston Apr 09 '17 at 21:36

0 Answers0