Introduction: Learning Java: Your First Program!
Computer Programming is a fun, interesting pastime that everybody should learn. With computer programming, or coding, people give a computer basic, simple commands which add up to create a complex, useful or entertaining program that can accomplish anything from math problems to playing a high-definition video. This coding is accomplished through a programming language. In this Instructable, I am guiding you through the process of downloading one of the most popular free programming engines: Java! In addition, I will teach you how to code your first program. Let's get started, shall we?
Step 1: What You Will Need:
1) A Windows Running PC (Any Windows Software Will Work: Slight Adaptations Might be Needed for Software other than XP.
See links below.)
2) An Internet Connection
3) Administration Abilities
Step 2: Finding the Java Development Kit
In order to begin programming, we first need to download the Java Development Kit, or JDK, and the Java software. Your computer might already have the Java Runtime Environment; this is more commonly known as the JRE, or simply Java. This lets you RUN Java programs, but not code them. In order to download the JDK, which lets you program Java software, you first need to go to the following website: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html. You should be at the page shown.
Step 3: Determining What "Bit" Your Computer Is
On this page, it is necessary for you to identify your computer's processing power (it is either 32-bits or 64-bits.) In order to do this, click the start button. Next, click on accessories. Go to system tools, and then system information. Find wherever the computer displays system type. If it displays X86-based PC, then your computer is a 32-bit. If it shows X64-based PC, then your computer is a 64-bit. In the case of the picture shown, I am running a 32-bit, as is displayed in the system information bar.
Step 4: Downloading the Java Development Kit
Finally, we will begin to download the JDK. Scroll down the page; make sure to accept the User's License Agreement. Next, click on the correct version of the JDK download for your computer's bit (either X-86 or X-64.) I have highlighted the Windows downloads in the picture for easier reference.
Step 5: Installing JDK Part One
After the download is complete, a window should automatically pop up. Click next, and then next again. After the installation process is complete, click close. This has completed the factory installation! However, there are still some settings that need to be changed for Windows computers to code at the full potential. Open the start menu and right click on the "Computer" or "My Computer" button. Next, click the "Properties" button in the popup menu. The image should more or less show what appears.
Step 6: Installing JDK Part Two
Click on the advanced tab on this popup menu. Near the bottom of the advanced menu is the environmental variables menu. Click on this button. In the middle menu, scroll to the Path variable, highlight it, and click the edit button near the bottom of the page, as is shown in the first image. A long list of computer words will pop up. Scroll to the beginning, and insert "bin;" in the string of characters so that it reads "C:\Program Files\Java\jdk1.7.0\bin;." This is shown in the second image. Finally, click OK until all the menus are exited out of. Now, we can finally begin true coding.
Step 7: Preparing for Coding
This is a simple step: open up "My Documents". Create a new folder called "Java Coding". Save it. Now we can finally code!
Step 8: Typing the Program
Open up the start menu. Scroll to the Accessories tab, and then open up a notepad. Type in the following words EXACTLY (Capitalization and all) except for one thing. There will be two quotes side by side below in the transcript. In between these quotes, insert any text you want.
public class FirstApp
public static void main(String[ ] args)
Save this file as FirstApp.java in the Java Coding folder. I will show another copy of the program in the picture.
Step 9: Running the Program
Open a command prompt. To do this, open the start menu. In the bottom corner, there should be a button marked run. Click on this and type in "cmd". Hit enter. A black box should pop up with white text. Type in the following: "cd My Documents\Java Coding". Next, type in "javac FirstApp.java". Finally, type in "java FirstApp". If the directions were followed correctly, the text you entered should pop up on the next line of the command prompt. Congratulations, you have successfully coded your first program in Java! My program is shown below.
Step 10: But What Now...?
This program represents just one tiny fraction of the vastness of accomplishments available through programming on Java. For more tutorials on how to code in this language, be sure to take a look at the following website: http://docs.oracle.com/javase/tutorial/. Also, most bookstores have several books on how to code in a vast assortment of programming languages; these are also very helpful in learning these languages. Thanks for viewing this instructable, and I hope you continue to be successful in your programming ventures.