Вы находитесь на странице: 1из 3

2/15/13

How to install the Java programming language on Windows germsovertheinternet

germsovertheinternet
My programming knowledge and experiences, not to mention germs

How to install the Java programming language on Windows


Before I get too deep into my blogging, I will start off by saying that most of the content or programs or pretty much anything I post about is for the Windows operating system if to do with computers at all. I am going to set up a Linux machine, but as of yet have not got one. Still the focus will primarily be for the Windows OS. I am not doing anything to do with any Macintosh OS as I dont have one, dont want one, and kind of have this thing aganst Steve Jobs and Apple in general. The purpose of this exact post is as you might have surmized from the title, how to install Java on the Windows operating system. I am running Windows 7, but this should work equally well for other versions of windows. Java is a very flexiblle language and is capable of operating on a lot of different operating systems. The process of installing Java for Mac or Linux should be equally easy, or challenging, depending on whether you have problems getting started. Step 1: Download Java. Oracle just recently bought Sun Microsystems, who were the makers of the Java programming language. So, nowe go to oracle.com in order to get the Java download. Click on the Downloads menu option at the top of the screen. Under Popular Downloads there should be a link called Java for Developers. Click on this link. There should be four big icons to click on. Java, JavaFx, NetBeans, and JavaEE. We want the first one as this bolog will for now focus on the Standard Editionof Java as opposed to the Enterprise Edition. Both I believe are free for all intents and purposes. The NetBeans download is an IDE or integrated development environment for Java, but also supports some other languages via plugins. It has a drag-and-drop graphical user interfae designer for the Swing GUI toolkit. This IDE is made by Oracle for developing Java applications, but as I am using the Eclipse IDE in schol, I will be using that IDE for my blog. Advantages of Eclipse over NetBeans will be discussed later. This post will not help you get set up with any IDE, but make use of the command line and Windows Notepad. Select your OS, in my case Windows 64-bit. Download the appropiate JDK. Ths download must be the JDK! You do not want the JVM (Java Virtual Machine) or the JRE
germsovertheinternet.wordpress.com/2011/05/26/how-to-install-the-java-programming-language-on-windows/ 1/3

2/15/13

How to install the Java programming language on Windows germsovertheinternet

(Java Runtime Environment). THese are neccessary for running Java applications but to develop them we need the Java Development Kit. The JDK comes with everything, except in this case an IDE, to program and run Java applications. Step 2: Install. The install should be fairly painless. Select the directory in which you wish to install java. Step 3: Configuring your path variable. This step is important for the purpose of running applications, and compiling them first, from the Command Prompt. Windows needs to know where the Java compiler lives. There are two ways that I know of to set user environment variable. One is via the command prompt and the other is through the control panel. We will go through the control panel method. Start->ControlPanel->System>AdvancedSystemSettings(on the left)->EnvironmentVariables. There are two groups: user variables and system variables. We actually want the first one, user variables. Click New. In the name field entry box type a name like Path. In the second field entry box type %PATH%;ThePathToYourJavaCompiler. Mine looks like: %PATH%;C:\Program Files (x86)\Java\jdk1.6.0_25\bin. The bin, which stands for binary, I believe, holds the javac file which is the program which will copile your Java class files into byte code. Java might actually create an intermediary language, for ack of a better term, so that this can run on the JVM. The JVM then runs on the OS. In my case Windows 7 64-bit. But it can run on Linux or MacOS. There is also a unix variation called Solaris made by the developers of Java. If you are a Mac user, you should actually already have , I believe, everything needed already installed. I believe the same for Solaris. This blog will cover neither OS. Step 4: Trying it out. Open Microsoft Notepad. First off save this file somewhere you can find it fairly easily, like the Desktop, and then name it FirstJava.java. the first bit is variable. Call it something else if you like, but it must have a suffix of java. Before we can copile a program, threre has to be some code. public class FirstJava { public static void main(String[] args) { System.out.println(I still function!!!); } }

germsovertheinternet.wordpress.com/2011/05/26/how-to-install-the-java-programming-language-on-windows/

Note that the class name MUST be the same as the filename! Now open the command prompt by

2/3

2/15/13

How to install the Java programming language on Windows germsovertheinternet

Note that the class name MUST be the same as the filename! Now open the command prompt by ither pressing WindowsKey+R, typing in cmd, and pressing enter or Start->Runcmd->enter. There is alo the option of Start- Type in>Programs->Accessories->Command Prompt. Once open this will look like a back box or window with grey text. You must first change the directory to the place where the .java file is saved. Well say this document is on the Desktop. To do this you must type cd Desktop. The cd means change directory, Desktop means current path plus \Desktop. Mine is: C:\Users\Michael 1.0\Desktop, as I am Michael version 1.0! To compile this file you must type javac FirstJava.java. If you dont get anything in the command prompt good! This means that your file has successfully compiled. Nw to run this program type: java FirstJava. Notice that the c of of the first word is no longer there and the .java is missing from the command. This is because It is no longer a .java file but a .class file. If you looked in yur directory after the first step, compiling the program, you should notice another document with the same name but the suffix .class and not .java. If this has not worked for you then try, try again. Or better yet ask questions. Oh and if you didnt get the movie reference, I still function! is something Megatron says in the original 1986 Transformers movie, after Starscream tosses him out of Astrotrain. About these ads (http://en.wordpress.com/about-these-ads/)

Please fill in your details, we will contact you shortly.


* All f ields are mandatory

First Name DD MM

Last Name YYYY

Mobile Number Email ID Salaried Company Name

City of Residence Annual Income

This entry was posted on 2011/05/26 at 23:54 and is filed under Java. You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.

Theme: Kubrick. Blog at WordPress.com. Entries (RSS) and Comments (RSS).

germsovertheinternet.wordpress.com/2011/05/26/how-to-install-the-java-programming-language-on-windows/

3/3

Вам также может понравиться