by Michael Thomas
If you have trouble with any of the steps below see the table below called "Help Notes".
Create a new directory to place the files you will work with. You can do this using Windows Explorer or using DOS (click here for Help with DOS)
The zip file you downloaded on the "Java First Steps Home Page" has a series of files that starts with "MyFirst_". Move them to the directory you just created.
Extract the files into the same directory.
MyFirst_setpathjdk.bat - Edit this batch file to point to your "JDK bin" directory. Each batch file will call it. Step 4 & Step 5 will use this file.
MyFirst_java_test.bat - Run this batch file (click on
it in Win Explorer) to test that you can run:
java.exe, javac.exe, appletviewer.exe
Do not proceed unless you can run the previous batch file without errors.
Compile and Run your first Java Applet. Java Applets are designed to run in a browser.
In Windows Explorer, click on "MyFirstApplet_compile.bat". This will compile the .java source code and create a .class file.
In the DOS compile window, you will see the "javac" command. Wait until you see the "pause" command. There should be no errors. Now press the "Enter" key.
Next click on "MyFirstApplet_view.bat". This will load Sun's appletview and display just the applet that is located in the file "MyFirstApplet.htm". In the appletviewer window you should see the words: "Hello World from an Applet"
Next click on "MyFirstApplet.htm". This will launch your default browser and should display the html file which will load the applet.
Next view the Browsers Java Console. You will need to have access to the Java Console for debugging and development testing.
IE Steps:
If you are following the steps, IE should be browsing the Applet. If not start IE.
Click on "View", then "Java Console". If this option does not appear the you need to configure IE5.x (maybe others) with the following steps:
Goto: Tools, Internet Options, Advanced (tab). Next check the option "Java Console enabled" which is located in the "Microsoft VM" section.
Compile and Run your first Java Application. Java Applications are designed to on a local machine which has a JVM (Java Virtual Machine) loaded. By the way, Java Servlets work the same way.
In windows Explorer, click on "MyFirstApplication_compile.bat". This will compile the .java source code and create a .class file.
In the DOS compile window, you will see the "javac" command. Wait until you see the "pause" command. There should be no errors. Now press the "Enter" key.
Next click on "MyFirstApplication_run.bat". This bath file will call the command "java" and execute the .class file you created when you compiled the .java source.
You should see on the DOS console the words: Hello World from an Application
This info is very valuable if you need it. Go ahead and do the following steps. If you ever need more DOS buffer to store your compile errors and/or your DOS window does not have a scrollbar, then you will need this info.
Launch a DOS window. I've listed several ways.
Start, Programs, Accessories, Command Prompt (or DOS Prompt)
Start, Programs, DOS Prompt
Win NT: Start, Run, cmd.exe
Win 95/98/NT: Start, Run, command.com
Additional note: If you press ALT-ENTER while in the DOS window you will get a full DOS window. ALT-ENTER again will minimize the window. When you are finished with the DOS window type "exit" at the command line to close the DOS window.
Next, right click on the title of the DOS command window and
choose Properties. Here is the following settings that I use vs Win NT
4.0 defaults:
Note: After making the changes, make sure you choose "Modify
shortcut which started this window" or you changes will be lost.
| Option | New Settings | Original Settings |
| Option Tab Command History * Buffer Size * # of Buffers Quick Edit Mode Insert Mode |
201 4 empty empty |
50 4 checked checked |
| Layout Tab Screen Buffer Size Width Height Window Size Width Height |
300 1900 80 25 |
80 25 80 25 |
| Topic | Notes | ||||||||||||||||||||||||||
Environment Variables:
|
DOS Environments:
View the DOS Environment Variables.
Changing the DOS Environment Variables.
DOS Variables: path & CLASSPATH
General Notes - Environment Variables:
Win XP
WinNT (NT4.0 & NT2000)
Win 95/98
Win ME
|
||||||||||||||||||||||||||
| CLASSPATH variable | CLASSPATH - | ||||||||||||||||||||||||||
| Goto a DOS prompt | Ways to get to a DOS prompt:
|
||||||||||||||||||||||||||
| DOS Commands |
Common DOS Commands
www.easydos.com - Helpful info on DOS commands. |
||||||||||||||||||||||||||
| Dos Filenames | DOS (some OS versions)
|
||||||||||||||||||||||||||
| Errors | Common Errors & Solutions
|