Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java compiler version and java version is different

Tags:

java

eclipse

I am trying to run a compiled java class and getting errors but when I checked my java environments it points to different version.

Javac –version gives me 1.8.0

And

Java –version gives me 1.6.2

The Java_home and path is pointing to the 1.8 version.

Please help.

like image 864
Nithin Varghese Avatar asked Dec 11 '25 01:12

Nithin Varghese


1 Answers

Java installation under Windows is sometimes a really severe source of pain. The following assumes that you have Windows:

  1. Check your path variable
  2. Check JAVA_HOME variable
  3. Newer versions of Java (1.6 ?, but 1.7 and 1.8) copy some Java executables into the System32 directory of the windows installation. Simply delete this files (or move them somewhere else for easy recovery)
  4. running java applications by using .bat files a specific JDK / JRE can be provided.

There may be more sources of your problem. For example with Maven you depend on JAVA_HOME, with Eclipse you have the project settings, ...

like image 75
Sebastian Avatar answered Dec 12 '25 13:12

Sebastian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!