Difference between revisions of "Team1/Creating your first Java project"

From CDOT Wiki
Jump to: navigation, search
(Creating your first Java project)
Line 15: Line 15:
 
[[Image: Java_Package2.jpg | 550px]]
 
[[Image: Java_Package2.jpg | 550px]]
  
<br/>1.5. Create Java class. Right click on the newly created package and select ''New -> Class''<br/>
+
<br/>1.5. Now you can add/create Java classes to your project
[[Image: Java_Class.jpg | 600px]]
 
 
 
<br/>1.6. Specify the name and check ''"public static voin main"'' in the ''method stubs'' section.<br />
 
[[Image: Java_Class2.jpg | 600px]]
 
 
 
<br/>1.7. Modify the main method:<br/>
 
<pre>public static void main(String[] args) {
 
        System.out.println("This is my first class");
 
 
 
    }</pre>
 
 
 
<br/>1.8. Run your code: Right click on your Java class and select ''Run-as-> Java application'' <br/>
 
[[Image: Java_Run.jpg | 600px]]
 
 
 
 
 
<br/>1.9. Check the Console, you should see the following: <br/>
 
[[Image: Java_Run2.jpg | 600px]]
 

Revision as of 06:49, 1 February 2011

Creating your first Java project

1.1. Select from the Menu: File -> New -> Java Project
Java Project.jpg



1.2. In the Create the Java Project window specify the project name (follow the Java convention) and leave "Use default location" checked. Press Finish to create the project
Java Project2.jpg



1.3. Now create a package. Select folder src, right click on it and select New -> Packege
Java Package.jpg


1.4. Specify the package name (Java convention is to use the same name as project). Press Finish
Java Package2.jpg


1.5. Now you can add/create Java classes to your project