Search Java Tutorials

Custom Search

What You Will Want to Complete This Tutorial?

You must have at least 1st and 2nd pre-requirements to start the tute. Other requirements will require for last chapters only. These all are free to use and download!
  1. Java Development Kit Standard Edition (JDK / J2SE) Any Version(www.java.com)
  2. Any Text Editor (Note Pad quite enough or get Notepad++ from (http://notepad-plus.sourceforge.net)
  3. Java Run Time Environment (JRE) Any Version(www.java.com)
  4. Java Enterprise Edition (J2EE) for advanced developing (For last few chapters)(www.java.com)
  5. Java Wireless Toolkit for Mobile Application Development (For Mobile Application Development Chapters) (www.java.com)
  6. Tomcat Web Server to run Servlets. (www.tomcat.apache.org/)
Your operating system may be any version of Windows.
What will you learn (As a summary)?
  1. How to build console and windowed applications using Java
  2. How to build web page elements with Java Applets
  3. How to build Database Programs with Java
  4. How to build enterprise applications with Beans
  5. How to add Email functions to Java programs
  6. How to program smart devices (Phone, PDA etc…) with Java

First Tour! Build Your First Program in 3 minutes!

Java wants only one thing from you that is your program description. You may give this description to java using a ‘.java ’ file. Description will include what your program going to do when it started.

Following program describes, it will show ‘First Java Program’ text on screen when user start it. Type the following java code description into your text editor. (Note: Numbers in the gray column are line numbers and it s just for easy reading. Do not type those things in your file!)

Save file into a directory (folder) using file name “First.java” (ex.: C:\MyJava\First.java)

Start Run application by pressing ‘CTRL’ key and ‘R’ key together. Type ‘CMD’ and press enter

to Start Command Prompt or DOS prompt.

Now you are going to start Java. Java software has no any graphical user interface as in Visual Basic. So, you can’t start Java using Windows Start Menu.

Follow the figure while reading this part and also take a look at DOS help at the end of this chapter.

To start java type ‘PATH (ex: C:\JDK1.4\bin) and press enter. You’ll see nothing special! But wait!

Now you want to move Command Prompt to location where you save “First.java”. Type ‘CD (ex: CD MyJava)

Tip: You may use ‘CD\’ command to jump into root of C: drive because according to this example our .java file is in ‘C:\MyJava’ folder.

Now you have to say, “Create my program please!’ Try this! ‘JAVAC First.java’


To Run Your Program Type ‘JAVA First’ and press enter (Be careful: Java is

Case Sensitive).

You must see ‘First Java Program’ appeared on screen.

If you get some errors, please check your code again. Look for missing semicolons and spellings, letter cases etc… Then check your “PATH” command is OK (Can you find bin folder of java manually?). Finally check you are at the right location to compile your code (In this example; I saved my code in C:\MyJava. You can see that Command prompt; prompt it at the last line).

That’s all! You will repeat this process every time you write a Java program. Lets See How to develop it into real windowed program from next chapter!

No comments: