How to install the Java programming language on Windows « germsovertheinternet

Embed Size (px)

Citation preview

  • 7/27/2019 How to install the Java programming language on Windows germsovertheinternet

    1/3

  • 7/27/2019 How to install the Java programming language on Windows germsovertheinternet

    2/3

    2/15/13 How to install the Java programming language on Windows germsovertheinternet

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

    (Java Runtime Environment). THese are neccessary for running Java applications but to developthem 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 theCommand Prompt. Windows needs to know where the Java compiler lives. There are two ways that Iknow of to set user environment variable. One is via the command prompt and the other is throughthe control panel. We will go through the control panel method. Start->ControlPanel->System->AdvancedSystemSettings(on the left)->EnvironmentVariables. There are two groups: uservariables and system variables. We actually want the first one, user variables. Click New. In thename 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 isthe program which will copile your Java class files into byte code. Java might actually create anintermediary language, for ack of a better term, so that this can run on the JVM. The JVM then runson the OS. In my case Windows 7 64-bit. But it can run on Linux or MacOS. There is also a unixvariation called Solaris made by the developers of Java. If you are a Mac user, you should actuallyalready have , I believe, everything needed already installed. I believe the same for Solaris. This blogwill cover neither OS.

    Step 4: Trying it out.

    Open Microsoft Notepad. First off save this file somewhere you can find it fairly easily, like theDesktop, and then name it FirstJava.java. the first bit is variable. Call it something else if you like, butit 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!!!);

    }

    }

  • 7/27/2019 How to install the Java programming language on Windows germsovertheinternet

    3/3

    2/15/13 How to install the Java programming language on Windows germsovertheinternet

    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 byither pressing WindowsKey+R, typing in cmd, and pressing enter or Start->Runcmd->enter. Thereis alo the option of Start- Type in>Programs->Accessories->Command Prompt. Once open this willlook like a back box or window with grey text. You must first change the directory to the placewhere the .java file is saved. Well say this document is on the Desktop. To do this you must type cdDesktop. 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 thatyour file has successfully compiled. Nw to run this program type: java FirstJava. Notice that the c ofof the first word is no longer there and the .java is missing from the command. This is because It is nolonger a .java file but a .class file. If you looked in yur directory after the first step, compiling theprogram, 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 youdidnt get the movie reference, I still function! is something Megatron says in the original 1986Transformers movie, after Starscream tosses him out of Astrotrain.

    Fi rst Name Last Name

    D MM YYYY

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

    * All f ields are mandatory

    Mobile Number

    Email ID

    City of Residence Salaried

    Annual Incom e Company Name

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

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

    About these ads (http://en.wordpress.com/about-these-ads/)

    http://germsovertheinternet.wordpress.com/feed/http://en.wordpress.com/about-these-ads/http://germsovertheinternet.wordpress.com/comments/feed/http://germsovertheinternet.wordpress.com/feed/http://wordpress.com/?ref=footerhttp://theme.wordpress.com/themes/kubrick/http://germsovertheinternet.wordpress.com/2011/05/26/how-to-install-the-java-programming-language-on-windows/trackback/http://germsovertheinternet.wordpress.com/2011/05/26/how-to-install-the-java-programming-language-on-windows/feed/http://germsovertheinternet.wordpress.com/category/java/