Java program development under Unix at UNCG



Java Applications

1. go the the directory (ex. myjava) containing your java application program:
>cd myjava
2. set classpath
>set classpath=
3. compile:
>javac hello.java
 Note: successful compilation creates hello.class file.
4. run:
>java hello



Java Applets

1. go the the directory (ex. myjava) containing your java applet:
>cd myjava
2. set classpath
>set classpath=
3. compile:
>javac ButtonTest.java
4. create html file referring to applet
5. run the applet without a web browser:
>appletviewer ButtonTest.html
or
6. in a Java-enabled web browser, go to url of html file, e.g.,
http://www.uncg.edu/~nlgreen/csc339/java/ButtonTest.html.
Note: to see source text of html files, click on Browser's Menus: View, then Page Source.


Miscellaneous

1. To find out what version of java is installed on AFS,
>  java -version
    Currently, the answer is 1.1.7

2. To create a log of output to System.out while running an applet:
>appletviewer ButtonTest.html > mylog
(when the applet is finished, the current directory will contain a file called mylog with
 everything that was written to System.out while the applet was running)



Java application program development on a PC

1.  Bring up a dos window
2.  cd to folder containing your program, e.g.
>cd C:\MyJava
3.  set environment variables:
>set classpath=
>set path=c:\jdk1.2\bin;%path%
4.  compile program, e.g. hello.java
>javac hello.java
5.  run
 >java hello