Carey Brown wrote:Delete 1 & 2. The 3rd one is ok but there's a better way. First, create a brand new environment variable named JAVA_HOME and set its value to C:\Program Files\Java\jdk-12.0.2
Then, modify your path so that this is THE VERY FIRST entry:
This helps in two ways: 1) it means that next time you install a new Java release you'll only need to modify JAVA_HOME, and 2) some applications, such as Eclipse depend on JAVA_HOME.
Campbell Ritchie wrote:Please adjust your PATH so it points to Java12 first, and remove the Java8u221 part from your PATH. Otherwise, when you compile code in Java12 and try to run it as Java8, you will suffer exceptions.
Hajile Latni wrote:. . . I have jre 1.8.0_221 installed before I have installed jdk-12.0.2 and I haven't uninstalled jre 1.8.0_221
then when I type java -version in cmd 1.8.0 always shows up and not 12.0.2
Have you managed to get your code to execute?
Junilu Lacar wrote:Also, what version of Java are you using? You can find out by running this command:
> java -version
Campbell Ritchie wrote:I was mistaken; sorry. that should read I thought it is only Java12 that will allow you to write java Main.java, but only under special circumstances including there not being a Main.class file.
Earlier today, I wrote: . . . . . .
Sorry; I missed the error of including the extension ….java in the instruction. Maybe your code will work if you miss out the extension.