0

I am trying to practice Java on my laptop (the tablet is VERY limited!) so have installed the recommended Oracle Java from java.com. This has installed Java 8 update 251 on my machine but I cannot make it work. If I follow the instructions, take a Java file (such as Example.java) and try to compile it using the command javac Example.java, I am met with the well-known reply:

'javac' is not recognized as an internal or external command, operable program or batch file.

I know that the usual claim is that there is no link to the correct directory, however there is no javac.exe (or bat or anything else for that matter) to link it to. Any suggestions please?

4

1 回答 1

2

This error appears when classpath is not mentioned for your jdk in env variables. You need to configure env variables and provide jdk path there. Make JAVA_HOME variable in path, provide JDK path there and add to to the path. This was for Windows. For Mac- you need to export the JAVA_HOME in the bash_profile To open bach_profile = open ~/.bash_profile

于 2020-05-13T10:29:09.397 回答