The latest version of the Java Software Development Kit (JSDK) is available from Sun Microsystems at: http://java.sun.com/javase/downloads/index.jsp You want to download the newest version of J2SE (or SE). When you get to the download page make sure to download J2SE and the SDK (Software Development Kit) not the JRE (Java Runtime Environment). The JRE only allows you to run java but not write and compile it.
The SDK is Java, as defined by Sun Microsystems, the creator of Java. The SDK will allow students to develop Java applets and applications on their home computers. Installation is pretty straight-forward. Make sure to check the system hardware requirements. Although Java 2 will run on those requirements, the machine they describe is very underpowered. A recommendation for Java development would be:
Once downloaded and installed, you will want to run programs. The steps in using the JSDK are as follows:
.java source code files (easy
for me to say, right?)..java source code files into .class
files using the command line tool javac,javac HelloWorld.javajava
command,java HelloWorld (notice the
lack of a file extention).html file and place an
appropriate <applet> tag in it and then load that .html
file into a web browser that supports Java 2 or use appletviewer
to view the .html file.<applet> tag: <applet
code="HelloWorld.class"></applet> (notice
the .class extention)Example .html file that can be used as a template:
<!-- This is an HTML comment --> <html> <head> <title>My Web Page</title> </head> <body> <applet code="MyClassName.class" width="600" height="600"></applet> <a href="MyClassName.java">Source Code</a> <!--The above line is an example of how to link to a file in the same directory that the .html file is in. --> <a href="_docs/index.html">JavaDocs</a> <!--The above line is an example of how to link to a file in the _docs directory, which is a subdirectory of the directory that the .html file is in. --> </body> </html>
Example Java Applet file named TestAppletFile.java
/** This is a javadoc comment.
* It can span across lines and will terminate
* with the next occurrence of and astrisk (*) character
* followed immediately by a / character. These types of comments
* may not be nested. When placed correctly, this comment will appear
* inside the documentation produced by the javadoc command.
**/
// This type of comment will comment out whatever follows it
// on the line.
/* This is a normal block comment that follows the same rules as a javadoc
* comment. Its contents will not be displayed in the javadoc
documentation.
**/
// The following import statements are required by an applet file.
import java.awt.*;
import java.applet.Applet;
// the following header defines the applet class.
public class TestAppletFile extends Applet{
// The following header defines the
init method.
public void init(){
//applet initialization
code goes here.
}// end of the init method.
// The following header defines the
paint method.
public void paint(Graphics g){
// code to display
graphics text and figures goes here.
}// end of the paint method.
}// end of the TestAppletFile class.