Java Setup
It's been a while since I set up Java last time (around 2015). After that, I use Java intermittently, but only in ready-to-go environments like [LeetCode] and replit. Now I decide to learn Java again and from the very beginning. This post will include how to set up the Java environment so it's ready to code.
OS: Windows 10
Install JDK8
The reason that I don't use the latest JDK (Java Development Kit) is that JDK8 is the most popular among enterprises.
Relationship between JVM, JRE, JDK: JDK includes JRE includes JVM
- Download JDK8
- configure Environment Variables*
create a new environment variable
JAVA_HOME, the variable value is the directory of the JDK (something likepath/to/java/jdk1.8)add the following to the
Pathvariable:1
2%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin
- open command prompt and type
java -versionto check if the JDK is installed correctly
* Difference between User Variables and System Variables:
System variables are shared for all users, but user variables are only for your account/profile [1]
Environment variables are 'evaluated' (ie. they are attributed) in the following order: System variables -> Variables defined in autoexec.bat -> User variables [2]
Uninstall JDK8
In Environment Variables, find Path, inside
you will find Java's directory. Go to that directory and just delete it.
Then remove it from the Path, and delete Environment
Variable JAVA_HOME.