Post by matthew on Aug 29, 2010 21:08:16 GMT
The following lines will show you how to develop a simple Java application entirely at the Command Prompt without the need for an IDE.
It assumes that you've added the Java bin folder to your PATH Environment variable.
Create A Folder for our Application
Move to the new directory we just created
The following line will allow us to enter our program at the Command Prompt
Type out the following code then hold Ctrl + Z & then press return to write the code to the HelloWorldApp.java file.
Compile the program with the following line
You can test our program to see if it works by typing this line
Before we create a Jar file we must first create a Manifest file.
Type out the following text & make sure you press return at the end of the line. Then hold Ctrl + Z & then press return to write the text to the Manifest file.
To create our Jar file we just type the following.
To create the documentation for our program we type the following...
If you navigate to the docs folder & open index.html with your Web browser you can then view the documentation.
You can download a ZIP folder containing all the files by clicking here.
It assumes that you've added the Java bin folder to your PATH Environment variable.
Create A Folder for our Application
mkdir HelloWorldApp
Move to the new directory we just created
cd HelloWorldApp
The following line will allow us to enter our program at the Command Prompt
copy con HelloWorldApp.java
Type out the following code then hold Ctrl + Z & then press return to write the code to the HelloWorldApp.java file.
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello, World!"); // Display the string.
}
}
Compile the program with the following line
javac HelloWorldApp.java
You can test our program to see if it works by typing this line
java HelloWorldApp
Before we create a Jar file we must first create a Manifest file.
copy con Manifest.txt
Type out the following text & make sure you press return at the end of the line. Then hold Ctrl + Z & then press return to write the text to the Manifest file.
Main-Class: HelloWorldApp
To create our Jar file we just type the following.
jar cvfm HelloWorldApp.jar Manifest.txt *.class
To create the documentation for our program we type the following...
javadoc -d docs *.java
If you navigate to the docs folder & open index.html with your Web browser you can then view the documentation.
You can download a ZIP folder containing all the files by clicking here.