Environment Variables Configuration for Java and C

I reinstalled the system yesterday and upgraded to Win10 2004. I thought I could configure the environment variables for Java and C from memory, but in the end, I had to turn to Google for help. So, I'll document it again.

This post was translated from my Chinese blog post with the aid of ChatGpt.

Java

  1. Simply search for environment variables in the taskbar search box, and you will find Edit the system environment variables.
  2. In the popup window, click on Environment Variables in the bottom right corner.
  3. Under System variables, create a new system variable with the variable name JAVA_HOME and the variable value as the installation path of JDK, which is typically C:\Program Files\Java\jdk-14.0.2 by default.
  4. Create another system variable named CLASSPATH with the variable value as .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;.
  5. Double-click on the Path variable in the system variables section, and click New in the top right corner.
  6. Add %JAVA_HOME%\bin and %JAVA_HOME%\jre\bin separately.
  7. Confirm and return to the desktop.
  8. Open the terminal and enter java -version to check if it was successful. If successful, it will display the Java version.
  9. If it’s not successful, try restarting and double-check the variables for correctness.

C

  1. In Mingw, select mingw32-base and mingw-gcc-g++, selecting more will lead to a very long installation process. You can select them by right-clicking and choosing Mark for Installation.
  2. Click on Installation in the top right corner and choose Apply Changes.
  3. In the popup window, click Apply to confirm.
  4. Wait patiently… Potato servers often report installation failures.
  5. After installation, follow the same steps to open system variables.
  6. Double-click on the Path variable in the system variables section, and click New in the top right corner.
  7. Add the installation path for Mingw, which is typically C:\MinGW\bin.
  8. Open the terminal and enter gcc -v to check if it was successful.
  9. If it’s not successful, try restarting.

Your environment variables should look something like this after configuration:
1
2