HTML Markup | JavaScript | Java | Home & Links
JR's HomePage | Updates | Site Map | Page Bottom
Why Use Java | Installing Java | Test Sample
IDEs | JR's Tutorials | Internet Java Tutorials

Java Authoring Info

Java is a modern, platform independent programming language that is object-oriented for code reuse. This page explains why one would use Java, how to install the Java Development Kit (JDK) and provides a simple test application to make sure everything that is needed is installed and working. Visual development environments (IDEs) are listed for graphical authoring. My Java tutorials complete with suggested projects reinforce the material presented. The tutorials assume some previous programing knowledge. Links to internet tutorials are provided for those who prefer to roll their own applications or adapt other's projects.

Why Use Java

Why should one use Java as an authoring language?

Installing the Java Development Kit

Select/download the appropriate Java Development Kit (JDK). The current version is JDK 8u65. Older operating systems may need an archived version. To add a visual interactive development environment (IDE), select with NetBeans instead of the JDK.

Run the installer program. WARNING: Do not try to change the directory that the JDK loads into. Not all software providers are careful to make the root independent ;-[ I came to much grief on that assumption.

Note: The environment path variable will have to be updated to point at the binary files folder for access to Java tools (eg. javac, JAR, keytool, jarsigner, JavaDocs). The path changes each version!

Note: Make sure the classpath variable starts with .; so that the current directory is searched before other directories.

You may want to create a sandbox or classroom folder for your project java class files that require access from anywhere. Add this folder name to the classpath environment variable.

java.com will run a check to verify that the Java Runtime Environment (JRE) has been installed correctly.

Test Sample

Use the following simple HelloWorldApp application to test that the SDK development environment has been installed correctly.

Wintel User Hint: NotePad will do as an editor but several features of more advanced editors are helpful. A very strongly recommended choice is TextPad which is Java aware (reserved words and punctuation are color coded) and can handle multiple files for easy cut-and-paste. If you install TextPad, be sure to place the Java quick compilation items in the tools menu by using Configure - Preferences - Tools - Add - Sdk.

Cut and paste the above source code or type it into your favorite editor. Save the file as HelloWorldApp.java in your Java working folder (say JavaStuff, JavaTutor, sandbox, etc.).

Next compile the source file into bytecode by using the command javac HelloWorldApp.java. If an error message stating Not Found occurs, type the command javac. If there is still an error message it means that the path needs setting (see the above note on installing). If there is no error at this point then the .java file is missing or there was a typing error. Most typing errors are due to case sensitivity. In Java, UPPER and lower case ARE different.

Finally run the application with the Java interpreter by using the command Java HelloWorldApp.

Note: The above application can be reused as a template for constructing many working Java applications. You may want to include it as a macro in your text editor.

The first two lines is a comment statement about the application's function. Comments are not required but are extremely useful as documentation within the source. Other notes and doc files may get lost but these stay right where they are most useful. A long comment starts with a /* or /** and ends with a */ Short one line comments begin with // and end with the <return>.

The third line starts with the reserved word public. This indicates that objects outside the object can invoke (ie call or use) it. The reserved word class indicates that we are building a new object specification (aka template) with the name that follows. HelloWorldApp is the class name (your choice) and is case sensitive. Java 'style' capitalizes only the first letter of each class name. Line four is an opening curly bracket that marks the start of the class definition.

Line five is the specification of a method (aka procedure in older languages). static indicates that it calls a class method and not an 'instance' method. The method's name is main and the reserved word void indicates that no result is returned. main has parameters in round brackets. String args[] indicates that any command line argument values given are being passed to main as an array of String type in the variable args. Line six has an opening bracket for the main() method.

Line eight invokes the println() method of the system.out object. The data to be printed is passed in the argument as a string datatype. Note that each Java statement concludes with a semicolon. Finally, closing curly brackets are used for the main and for the object definition.

Interactive Development Environments

Visual interactive development environments allow advanced programmers quick methods to build and debug large projects. IDEs of interest are: BlueJ, DrJava, Eclipse, JDeveloper, JCreator and NetBeans

Note: Although advanced programmers use an IDE in projects, many learners find learning the IDE confuses them with learning Java itself and prefer to use only a basic text editor.

JR's Java Tutorials

Do you want to learn more about Java programming! Do you have an applet or application that you want to write for yourself. Then get your favorite editor ready and jump into my set of tutorials on the fundamentals of Java. They include plenty of samples and projects. And if you have questions or want to provide feedback, please email me.

Note: For those who prefer to work off-line, I have created a fileGrab utility in Java that will download all Java tutorials, source code zip packages, and required supplementary files. Follow these steps to get the tutorial material:

  1. Create a new folder that will contain the fileGrab utility and the tutorial material.
  2. Move into the folder and download the network utilities zip file [12 kb]
  3. Unzip the files named fileGrab.java and fileGrab.bat
  4. Compile the application using the command javac fileGrab.java.
  5. Download javapack.lst, the current list of tutorial files to be downloaded for off-line viewing.
  6. Run the application using the command fileGrab.bat.
  7. Use your browser to test that all the files are ready to use offline. The root file is jaintro.htm (this page)

Internet Java Tutorials


JR's HomePage | Comments [jaintro.htm:2016 03 17]