andreaalf97 / ing-sw-2019-Alfieri-Carrioli-Ceruti

Adrenalina: the digital remake of a board game
2 stars 0 forks source link

[Linux terminal] Java and Javac have different versions #8

Closed andreaalf97 closed 5 years ago

andreaalf97 commented 5 years ago

Good evening,

andreaalf97 commented 5 years ago

Good evening, I am trying to test if, when printing the map on CLI, I am obtaining the same results on both the IntelliJ console and my linux console.

To do so, I am trying to compile and run our MapPrinting.java file, but when I run I get the following error

Error: LinkageError occurred while loading main class MapPrinting
    java.lang.UnsupportedClassVersionError: 
MapPrinting has been compiled by a more recent version of the Java Runtime (class file version 56.0), 
this version of the Java Runtime only recognizes class file versions up to 55.0

Testing javac and java:

$ java --version
openjdk 11.0.3 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.10.1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.10.1, mixed mode, sharing)

$ javac --version
javac 12.0.1

My java folders are:

/usr/lib/jvm$ ls
default-java  java-1.11.0-openjdk-amd64  java-11-openjdk-amd64  java-1.8.0-openjdk-amd64  java-8-openjdk-amd64

/opt$ ls
ATT50791.KEYS10539026  jdk-11.0.2  jdk-12.0.1  minecraft-launcher  node-v10.15.3-linux-x64  SceneBuilder  sonarqube-6.7.6

My $JAVA_HOME is empty but my .bashrc contains

export PATH=$PATH:/opt/jdk-12.0.1/bin/:/opt/sonarqube-6.7.6/bin/linux-x86-64:/opt/node-v10.15.3-linux-x64/bin

How can I also use Java 12 when I run the java command?

ingconti commented 5 years ago

so You are sure You have only java as javac says... 12.0.1 ok...maybe only settings. info are a bit missing.. but anyway have You already give a watch on stack overflow?? seems well known...

ingconti commented 5 years ago

pal DO NOT close by yourself. Only tutors and lab teachers can.

andreaalf97 commented 5 years ago

This was solved by reinstalling everything from scratch. Please close the issue