Setting Environment Variables for Java on Windows
To establish environment variables for Java in a Windows operating system, specifically for the classpath, follow these instructions:
Environment Variables for Java SE Development Kit 8u112 on 64-bit Windows 7 or 8
User Environment Variables:
- JAVA_HOME: Path to Java root folder, e.g., "C:Program FilesJavajdk1.8.0_112"
- JDK_HOME: %JAVA_HOME%
- JRE_HOME: %JAVA_HOME%jre
- CLASSPATH: .;%JAVA_HOME%lib;%JAVA_HOME%jrelib
- PATH: Custom path entries;%JAVA_HOME%bin (ensure no other Java installation folders are referenced)
Additional Notes:
- Windows 64-bit users may need to use 'Progra~1' for 'Program Files' and 'Progra~2' for 'Program Files(x86)' in the paths.
- JAVA_TOOL_OPTIONS can be set as a user environment variable with the value "-Dfile.encoding="UTF-8"" to enforce UTF-8 encoding for Java and its tools.
- Remove the system environment variable 'C:ProgramDataOracleJavajavapath;' from 'Path' to maintain consistency during JDK updates.
The above is the detailed content of How Do I Set Java Environment Variables (Including CLASSPATH) on Windows?. For more information, please follow other related articles on the PHP Chinese website!