Created by: HappyFace
Last modified: 2 June 2007
Version: 1.0 - final
Note: topic is locked.
1) IntroductionWelcome to my first tutorial / how to about coding in the java programming language. As a senior software engineering student I have several years experience with the Java programming language and I hope to teach you (beginners?) the basics of Java so that you can code your own awesome Java application(s)!.
2) Install JavaTo be able to code in the Java language you need to make sure your computer has Java installed. If you are not sure you can get a copy here:
http://java.sun.com/javase/downloads/index.jsp if you are running a Windows platform you can test it by downloading the "Javatest.bat" in the attachment below this topic.
I'll assume that Java is succesfully installed on your computer so lets move on to the next chapter!
3) Using Java IDE ?IDE stands for
Integrated Development Environment and is vey usefull for software engineers like me because with IDE's you can code/debug/compile/run within the application itself instead of doing these steps seperatly. For this tutorials we will be using Eclipse/JBoss IDE.
Download Eclipse here: http://www.eclipse.org/downloads/Download JBoss IDE here: http://labs.jboss.com/jbosside/download/index.htmlJboss IDE is based on Eclipse so both IDE's should look & feel very similiar and no install is required, just unzip it and run the application. As for me I use JBoss IDE and Textpad because i'm used to it but if you like Eclipse or any other IDE tool feel free to use that instead.
Other Java IDE's:http://www.textpad.com/http://www.jcreator.com/4) Testing your IDE and code your first "Hello World" Java applicationAfter you are done setting up your preferred IDE(s) its time to finally code an application to test if everything works on your system!
If you use Eclipse you must create a new project by:
file -> new -> project and select the Java project, hit next and name the project "HelloWorld" click finish. After that click on the project with your right mouse button
new -> class and name your class "HelloWorld" afer that is done you can code your class in the main window.
Here is my code to demonstrate the "HelloWorld" class:
GeSHi (java):
/*--------------------------------------------------------------------------
// File and Version Information:
// $Id: Template.java,v 1.5 2003/09/13 20:03:52 gowdy Exp $
//
// Description:
// A simple HelloWorld class with an output.
//
// Environment:
// This software was developed with Eclipse and Java 1.6
//
// Author List:
// HappyFace <Creator>
//
//
// Copyright Information:
// Copyright (C) 2007 <Institution><None>
//
//----------------------------------------------------------------------*/
public class HelloWorld {
public static void main
(String[] arg
) {
System.
out.
println("Hello World");
}
}
Created by GeSHI 1.0.7.20
Run the application by right clicking on the "HelloWorld" file in the package explorder and select: Run as -> Java Application. If all goes well the console should print out "Hello World"
Thats it! You just compiled and runned your first Java application!
Attachments included for this tutorial:Javatest.bat
HelloWorld.java
HelloWorld.PNG
helloworldrun.PNG
helloworldnew.PNG