1

I'm trying to compile this java file manually (for learning purposes):

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

So I saved file and run:

C:\Users\maikon.neitzel\Documents\Java>javac Test.java

No errors.

Next step:

C:\Users\maikon.neitzel\Documents\Java>java Test
Error loading class Test: Bad major version number

So I did my research and found things about the PATH.

So I did it:

This are the variable for my user:

JAVA_HOME: C:\Program Files\Java\jdk1.8.0_102

PATH: %JAVA_HOME%\bin

JRE_HOME: C:\Program Files\Java\jre1.8.0_102

And there is another PATH for the system where I put the same:

%JAVA_HOME%\bin

This is on Windows 10, and with the last java 8 version.

Versions:

C:\Users\maikon.neitzel\Documents\Java>javac -version
javac 1.8.0_102

C:\Users\maikon.neitzel\Documents\Java>java -version
java version "1.1.8.16"

From where this java 1.1.8.16 is coming?

Thanks a lot!

  • There must be something else on your `PATH` called `java`, before the `%JAVA_HOME%\bin` entry. There might be another `Path` variable too. – Jorn Vernee Aug 02 '16 at 10:25
  • http://stackoverflow.com/questions/25074017/java-version-and-javac-version-showing-different-versions this might help. – eldo Aug 02 '16 at 10:25
  • Solved. I found a `c:\orant\jdk\bin` **AFTER** `%JAVA_HOME%` at system variables. So I figured I needed `%JAVA_HOME%` defined not only for my user, but at system variables too. Thank you guys. – Maikon Neitzel Aug 02 '16 at 11:33
  • @MaikonNeitzel please close the question, it is still marked as unanswered. – Sameer Puri Aug 03 '16 at 21:34

1 Answers1

1

Solved. I found a c:\orant\jdk\bin AFTER %JAVA_HOME% at system variables. So I figured I needed %JAVA_HOME% defined not only for my user, but at system variables too.