Developing Java Applications with NetBeans http://www.netbeans.org
Creating a new Project
Different kind of projects
The general project
Adding a new Java Class to the Project Produces this result
We can delete everything and leave just the following package javaapplication1; Name of the project public class Main { Name of the class (file) public static void main(String[] args) { this is to mark the beginning of the instructions of the program } This marks the end of the program } This marks the end of the class
Compiling the application
Running the Application
The Output field
Compilation Errors
Changing the properties of the project
Adding classes from an external jar file
Selecting the file
The file containing the new classes will be added during compilation and execution
Telling the compiler to “import” a certain class from the jar file At the top of the program you have to write import <package>.Console; Package is the name of the pacakge containing the classes (in this case, JConsole) package javaapplication1; import JConsole.*; public class Main { public static void main(String[] args) { Console c = new Console(); for (int i = 1; i <= 10; i++) for (int j = 1; j <= 10; j++) c.println(i+“ * “+j+” = “+i*j); }
For more programs you just need to add classes to the project
And give the name of the new class