Get DrJavaThis is the latest stable release of DrJava. DrJava is now a Sourceforge project. This site has a complete tutorial on installing Java on your machine.
For Newbies
- Go to The UNIX Start Page to find out how to get started with UNIX and how to compile Java at the UNIX command line
- Sun's Java Tutorial will help you get started from scratch
- If you run Windoze, you need to get a Java Developer's Kit (JDK). This page has a link to download it. Make sure you get the JDK and not just the JRE. Installing the JDK automatically installs the JRE.
General References
- Here is a link to Oracle's Java Site
- Here is a link to the current 8.0 Java API guide.
- Here is a link to Sun's Howtos on GUIs
- Bruce Eckel's website has some online books including Thinking in Java. This is a great book for those with some programming experience
A Basic Ant File for Building Jar Files
Copy this file and place it in a file named build.xml.
<?xml version = "1.0" ?>
<project default = "main">
<target name = "main" depends = "compile, compress">
<echo>
Building the .jar file
</echo>
</target>
<target name = "compile">
<javac srcdir = "."/>
</target>
<target name = "compress">
<jar jarfile = "Foo.jar" basedir = "." includes = "*.class">
<manifest>
<attribute name = "Main-Class" value = "Foo"/>
</manifest>
</jar>
</target>
</project>
Now place this in a directory along with your .java file. The file here is named Foo.java; its contents are as follows.
public class Foo
{
public static void main(String[] args)
{
System.out.println("Foo");
}
}
Now enter the ant command at the command line like so. You will need to have ant installed.
$ ant
Then you will see this
$ ant
Buildfile: /Users/morrison/antText/build.xml
compile:
[javac] /Users/morrison/antText/build.xml:10: warning: 'includeantruntime'
was not set, defaulting to build.sysclasspath=last; set to false for repeatable
builds
[javac] Compiling 1 source file
compress:
[jar] Building jar: /Users/morrison/antText/Foo.jar
main:
[echo]
[echo] Building the .jar file
[echo]
BUILD SUCCESSFUL
Total time: 1 second
To run the jar file, just type
$ java -jar Foo.jar Foo