I just started to learn Java programming. Following a guide/tutorial, I created my first .java file. The problem accrued when I tried to compile the .java file.
I have installed Java SE Development Kit 8u131. I have set the user Path variable to C:\\Program Files(x86)\\Java\\jdk1.8.0_131\\bin
but that didn't work.
The exact error I get when using javac command is the following: 'javac' is not recognized as an internal or external command, operable program or batch file.
Can you guys help me get the javac command working? I have no idea what the problem might be besides the Path variable.
First you need to check that JDK is installed in which Directory (inside C drive of Windows OS), than follow these steps :
Click New and write your JAVA path and click OK everywhere
JAVA paths :
C:\\Program Files\\Java\\jdk1.8.0_131\\bin (for 64-bit OS)
C:\\Program Files (x86)\\Java\\jdk1.8.0_131\\bin (for 32-bit OS)
I think you should quote your path, because it contains a space:
You should have a JAVA_HOME variable in 'User variables' section which points to the jdk folder (not bin folder), ie set the value to
C:\\Program Files(x86)\\Java\\jdk1.8.0_131
The you should edit the 'Path' variable in 'System variables' and add the path that points to the bin directory of the jdk folder, which you have already done.
Path varaible should have the following entry:
C:\\Program Files(x86)\\Java\\jdk1.8.0_131\\bin
Also, just make sure you have an entry that points to the command propmt inside Path varaible, these are stored by default, but in case you have messed with them
C:\\Windows\\System32\\WindowsPowerShell\\"Version folder goes here"\\
Or
C:\\Windows\\System32\\
Now you should be able to compile and run successfully.
You need to verify java_home variable by echo %JAVA_HOME%
command and install this variable if not present to C:\\Progra~1\\Java\\jdk1.8.0_131
or C:\\Progra~2\\Java\\jdk1.8.0_131
when your java installation in (x86) folder. After that verify your installation by java -version
command
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.