Saturday, June 13, 2009

You recognize the scope Programming

IDE is a programming equipment in the integrated into the application software that supports the development of GUI, text or writing code, the compiler and debugger. This tutorial uses Ubuntu Dapper as the operating system. Before use this tutorial, make sure that have installed Java and NetBeans in system you use. For instructions on how to install Java and NetBeans, can be seen in Appendix A. For versions of Windows XP in this section, can be seen in Appendix B.
Before discussing more detailed, at first we will see the first Java program that you will write.

First Java Program

public class Hello
{
/**
* My first java program
*/
public static void main(String[] args) {
//Display the words "Hello world"
System.out.println("Hello world!");
}
}

Before explaining what the meaning of the program, try to write a program in a file and then run it.

Using the Text Editor and Console

In this example, we will use a text editor to edit Java programs. You will also open a terminal window to compile and execute your Java program.
Step 1: Starting Text Editor To start the text editor in Linux, click on Applications-> Accessories-> Text Editor.

Step 2: Open the Terminal To open a terminal in Linux, click on Applications-> Accessories-> Terminal.


Step 3: Write a Java program listing in your text editor.

Step 4: Keep your Java program This program will be stored in a file called''Hello.java'', and stored in a folder named MYJAVAPROGRAMS. To open the Save dialog box, click on the File menu in the menubar and
then click save. After installation, the dialog box will appear like the picture below it.
Picture


Click on the browse button, then click Create Folder.




Name the new folder, MYJAVAPROGRAMS. Now, click on the folder MYJAVAPROGRAMS to know the contents of the folder that is inside. After you click on the folder, you'll see a picture like that shown below. At this time folder should be empty until a new folder terbuatnya and we will save everything inside the folder.


Now, in the textbox Selection, type the file name of your program, that is Hello.java'''', then click on the SAVE button.


Now you've saved your file, remember how the name of the frame can changed from''Untitled Document 1 (modified) - gedit''to "Hello.java (~ / MYJAVAPROGRAMS) - gedit. "If you want to make changes to your file, You only need to edit, and save them again by clicking the on File-> Save.


Step 5: Compile your program The following is a program you compile. Go to the Terminal Window that we have been open before. When you open a terminal window, the terminal window that displays referred to as your home folder. To view the contents of the folder, type ls and then press ENTER. What you will find is a list of files and folders in it.
You can see is the folder with the name "MYJAVAPROGRAMS" we have created earlier, and is a place where we save the program Hello.java us. Then go to the directory. To enter into a directory, type the command: cd [directory name]. Cd''command''is used to change the directory. In this case, the name of the directory we MYJAVAPROGRAM is, then you must type: cd MYJAVAPROGRAMS.


Once inside the folder that contains your Java program, it is time to begin to compile the Java program. As a note, that the file you meaning there must be inside the folder you select. Check with the ls''command''to see that you have in the file folder.


To compile the Java program, use the command: javac [filename]. Deep this case, you mengetikan command: javac Hello.Java.


During Compilations, javac add the file to disk in the so-called [filename]. class, or in this case, Hello.class, which is the actual code.

Step 6: Menjalakan Program During the Compilations process, javac add new files into the disk which is called [filename]. class, in this case, Hello.class, which is the actual time code This, with the estimates do not have problems with the compile time process (we will investigate and discuss the problems found during the compile process, the the next section), is a ready to run your program.
To run your Java program, by typing the command: java [filename without the extension], then in this case, you type the command: java Hello. Now you can see on the screen that you have to run a Java program You first, which displays the message,''Hello world!''.



Also Read:

1 comment: