Java Introduction |
A bit about what is going in here. |
1. Some data on the material that I am using. This is from the viewpoint of someone fairly new to java and who had a bit of a problem the first time around. |
My first run at Java was about a year ago, just after the Java 1.12
JDK came out.
What happened was that I had the JDK downloaded and the Java guidelines. Unfortunately I did not make much headway with that operation. I kept going into the MS-DOS mode and then had no access to windows and the MS-DOS editor does not like long filenames. Then I started using my old Borland C/C++ program editor and had no better luck with the long filenames and because of these problems I did not do much work with Java. Since then I have acquired Canyon softwares Drag & File Gold file managing utilities and the Programmer's File Editor (a multi-file, large file editor) and this took care of the file handling problems. Unlike HTML and JavaScript, I was unable to put the programs together using just the on-line guidelines. I recently acquired Noel Enete's Java Jump Start book from Amazon books and things are moving quite well now. Cost me about $28.00 and got it in two days. This is the kind of book that I prefer for an initial assualt on a programming language. It has short chapters and lots of example programs. Unfortunately it is using Java 1.02 but fortunatley it has a CD which has the Java 1.02 JDK so that I can compile and run the programs - not all with Communicator 4.04 but with Navigator 3.03. Some run with Communicator, but not all. I have a list of chapters and its example programs and applets at:
|
The book contains 2 Hello Examples. One for an application and 1 for an applet, but it does not have one for a stand alone frame. This was the one that I kind of thought they would present. I have put a Hello zip file here for those who are interested. It is a multi-line, with button standalone frame program. It can be downloaded by clicking on the link. |
Some Terms Stuff:
When I first looked at the Java programs and applets I was very unsure of what all the terms meant and just what to do with the material available. An applet is a Java written program that can be placed and runs in a regular web page, you still need to put some code in your web page to load the applet. This code is usually available where ever you find the applet. An application is a program which is like a regular program written
in basic, c, c++, etc. and it requires what they call a Java Virtual Machine
to run it.
So what is this JDK thingy? This is the Java Development
Kit and they have different versions of it.
|
For those just starting out with Java, I do recommend the following:
let's you set up your own file extensions to call up. - I am using the Programmer's File Editor ( a free for personal use multi-file editor - I have a zip copy which may be downloaded by clicking on the link. ) The JDK and Guidelines for the version of Java that you will be using. I use the following batch files when working with the 1.02 JDK.
|
BATCH FILES:
COMPILEIT.BAT FOR PROGRAMS:
ECHO OFF
ECHO.
ECHO. |
GoApplet.BAT FOR Viewing
Applets
I now use the same CompileIt.bat batch file for both programs and applets. I split off the appletviewer command completely from the applet compile it batch file, because it saves time not to recompile the applet after I have already had a good run. I put this GoApplet.bat file in the JumpStrt directory, as this directory path is set in the setup autoexec.bat file that I run before each sesson. |
CLS
ECHO OFF ECHO.
appletviewer AnimateApplet.html cd \JumpStrt\Applets\AnimateApplet ECHO.
|
GO.BAT FOR PROGRAMS
I now put this file in the JumpStrt directory also. |
CLS
ECHO OFF ECHO. ECHO. LOADING ArrayPositions Java 1.02 Program ECHO. c:
ECHO.
|
AUTOEXEC.BAT FOR PATH
AND PROMPT SETTING
I put this in the primary Java directory. |
|
SET PATH=C:\WINDOWS;C:\WINDOWS\SYSTEM;C:\WINDOWS\COMMAND
path=%path%;C:\OPTI924 path=%path%;C:\JumpStrt\java\bin;C:\JUMPSTRT prompt 1.02 $p$g
|
|
I have set up a Programs subdirectory for the Java Program files and an Applets subdirectory for the Applets Files. Each Application program or Applet program has its own subdirectory. This does make life a lot easier. Also when you compile the programs you often have more than one class file that comes out of the compilation and this makes it easier to see what files are actually in the program. | |
SETTING UP:
1st. I have put a MS-DOS shortcut on my Quick Launch Toolbar (IE 4.0 Desktop setup) 2nd. I click the MS-DOS icon and
then use a CD \jumpstrt to move to my primary Java
3rd. I type in autoexec to run my Java autoexec.bat file 4th. I use my Drag and File file
manager to set up the subdirectory that I will be using for
5th. This was changed because of the new method of using the CompileIt batch files. 6th. I alt-tab to the MS-DOS window
and then CD programs\newsubdirectoryname
7th. I open up my Programmer's File
Editor (it is on the Quick Launch toolbar also) and
8th. I click into the compileit.bat
file and then mouse the the last program name and then
9th. I click on new file and type in the current program and save it. 10th. I Alt-tab to the MS-DOS window
and type compileit
11th. After a good program compile, I then type gopgm or goapplet and the Java progam will run or the Java applet will show up in the appletviewer. |
COMPLETION ROUTINE:
When I am through working with Java 1.02, I have to reset my regular paths so I go back to the MS-DOS window and CD \ and then type in autoexec to rerun my usual setup autoexec.bat file. I have put a prompt Reg $p$g in my regular autoexec.bat file so I have a double check on which paths my machine is currently set up for. I then type in exit and go on with whatever is next. |
|