I was messing around with writing Java code without an ide, and compiling/running with command prompt. When I try to create the .class, I get an error saying that Javac is not recognized. I was looking for answers when I found this thread https://stackoverflow.com/questions/1299750/javac-not-recognized
But nothing was working. I have done the following
- Set C:Program FilesJavajre1.8.0_51bin as a path
- Set the path in the command line
- Reinstalled the jdk
It also should be noted that If I had the .class then java Main.class
will work
Advertisement
Answer
From the path you are using (C:Program FilesJavajre1.8.0_51bin
), it most likely is a JRE.
javac
is part of the JDK.
Also, you should use a recent version of Java 8.
- Oracle Java 8u202 (last version before the licence change)
- Adopt OpenJDK (the link point to the JDK 8).