Java on Linux
Logon a Linux machine in the computer lab, using your 112 account.
You may have to reboot.
Developing applets in Java
- Go to the public_html directory (cd public_html).
- Create and go into a directory where you will be doing the current java
work (e.g. cd Lab1).
- Use emacs to create the HTML file and the java file. E.g.
- Compile with the JDK compiler, javac. E.g.
The resulting file will be a class file, e.g. myApplet.class.
- Make sure the permissions on the html and class files are OK
(i.e. everybody can read these files). Use
ls -l *.html *.class
to see these permissions. If they are not OK, change them with
chmod a+r myApplet.class
chmod go+r myApplet.class
- To view the applet, launch a web browser. Go
to the html page you have created. E.g.
- If you get an error, look into the Java console for more
- To make corrections, go back to the terminal window. Edit and
compile again your java file.
CAREFUL: if you go back to
the web browser and reload the page, the applet may not be reloaded and you
will see the old version of your applet (before corrections). You
may have to close the browser and launch it again. To simplify this
process, set it to always go to the last visited page, from the Preferences
Developing applications in Java
- You do not need a web browser.
- Compile the application - as before - with the javac compiler.
- Run it with java myApplic