Академический Документы
Профессиональный Документы
Культура Документы
germsovertheinternet
My programming knowledge and experiences, not to mention germs
2/15/13
(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
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/)
First Name DD MM
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.
germsovertheinternet.wordpress.com/2011/05/26/how-to-install-the-java-programming-language-on-windows/
3/3