Is your Machine Java Ready?
We become what we behold. We shape our tools and then our tools shape us.
My father in law used to own a hardware store. When I would occasionally visit the store I would gaze at all the tools he had in his inventory. Initially, I thought that just owning the tools would make me handy. He warned me thought that just owning the tool is just the start. We need to know how to use the tool and when to use the tool. There are a few tools we need to have to develop Java code. Let’s go over what you need and how we use them.
What do you need
I remember starting my Java development career. The three items we will discuss confused me. When do you need the JDK? When do you need the JRE? These questions and why can’t the Cubs win a World Series. The last question was resolved in 2016 the rest we will cover here.
When you want to do software development you need the Java Development Kit or JDK for short. It contains the compiler which takes your code and makes an executable. The current link for Java 11 Development Kit is here.
The Java Runtime Environment or JRE is for running the programs that you create with the JDK. It is a subset of the JDK. End users will need this on their machine or device to run the software you create.
The Java Virtual Machine(JVM) is where compiler output which is called bytecode runs. There is a different JVM for each type of machine. So make sure you have the right one. I have recently switched to MacOS after years on Windows so I sometimes download the wrong one.
We are going to need a few things to set up your computer to program Java. The first thing we will get Java installed on your machine.
The Java Development Kit install will be first. Depending on what type of machine you have. We will cover Windows and PCs. I know there is a Linux personing saying what about me. Chances are they can figure it out themselves…
As a long time Windows user, I have done this install many times. Here is the link to the Java Development Kit for version 11. You can select the executable version for Windows.
Once you download it you can click the executable.
Go to Control Panel > System and Security > System.
Under Advanced System Setting option click on Environment Variables as highlighted below.
Add Java to the “Path” variable under System variables. Select the “Path” variable and click on Edit button as highlighted below.
Test it by opening the command prompt and typing ‘java -version’. You should see something like this.
For MacOS select the dmg version and download it.
Double click on the install.
Follow the prompts to install Java Development Kit on your Mac.
Open a Terminal
Type export JAVA_HOME=/location to java
Type echo $JAVA_HOME to ensure it is set
Setup Path statement on Mac
Open up Terminal.
Run the following command:
sudo nano /etc/paths
Enter your password, when prompted.
Go to the bottom of the file, and enter the path you wish to add.
Hit control-x to quit.
Enter “Y” to save the modified buffer.
That’s it! To test it, in new terminal window, type:
Integrated Development Environments(IDEs) are a big part of where developers spend their time. The Java tools have come along way and provide many resources to help you write and debug your code. We are going to use one IDE that I am the most familar, Eclipse. Although we will briefly discuss IntelliJ too.
Eclipse is an open-source application that many developers use. It can be used to develop other languages besides Java. You can download from the Eclipse website. Go to the download site and install the version that works for your type of machine. Then you can install it.
JetBrains makes a great IDE as well. It is called IntelliJ. They have a commercial and community version. The later is free. It has fewer features than the commercial version. Feel free to download it here.
Originally posted on MyITCareerCoach.com