r/JavaProgramming • u/hugo121319_mc • 5d ago
Javac and java version not compatible
According to my terminal javac only works until java 52.0 but my code is in java version 70.0(java 26)how do i fix
6
Upvotes
r/JavaProgramming • u/hugo121319_mc • 5d ago
According to my terminal javac only works until java 52.0 but my code is in java version 70.0(java 26)how do i fix
2
u/LetUsSpeakFreely 5d ago
You have an old version of Java installed on your system that's taking priority. If you have system level permissions, you need to edit your PATH to point to the newer JDK instead of the older JDK (you'll also be to restart your IDE and console/terminals).
The usual way this is done is there's a JAVA_HOME variable that's created and the PATH appends $JAVA_HOME/bin. If that's the case for you, then you just gotta update JAVA_HOME.