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: 
   Java\JumpStartExamples.html  . 

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.

When you download Java applets and applications you will usually see two types of files listed, at least.  One is usually a .java ending and one a .class ending.  The .java file is a text file and that is the one that can be changed or modified with a regular text editor.  The class file is the actual program file and is in compiled form and if you look at it you just see what looks like garbage.  The class file is the file that is actually called to run a program.  If the program that you downloaded does not contain a .class file then you will need a JDK system to compile the .java file in order to be able to use it.  If you do not see a .java file, the program will still run, but they do not want you to mess with the code and so have not made it available.  The program will still run fine  as long as you have the .class file and it is in a Java version that is compatible with your web browser.   I am finding out that not all Java 1.02 programs will  run in Communicator 4.04.  Some I have to use Navigator 3.03 to run.

So what is this JDK thingy?  This is the Java Development Kit and they have different versions of it.
The Microsoft and Sun versions seem to be different, so I go with the Sun version, as they are the developers of Java - as far as I can tell anyway.  Sun Java material is available at java.sun.com .  The developers stuff is in a developers section and that is where the JDKs are to be found.  They tell you the conditions set on each one.  If you are serious about Java, you should join the Sun Java Developers Connection and thereby gain access to even more  material.
 

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

For those just starting out with Java, I do recommend the following: 
A decent beginning Java book - I am using Java Jump Start (Java 1.02),
A file manager that shows long file names - I am using Canyon software Drag & File,
A text editor that:
    will handle multiple files,
    has a good find and replace function,
    shows long file names in its directory list,

              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. 
          autoexec.bat    -  for setting up the paths required for the 1.02 JDK 
          compileit.bat    -  for compiling the program or applet 
          go.bat                 - for running the programs.

BATCH FILES: 

COMPILEIT.BAT FOR PROGRAMS: 
I now put this in the JumpStrt directory, as this directory path is set in the setup autoexec.bat file that I run before each sesson. It cuts down on the file overhead this way. 

ECHO OFF 
CLS 

ECHO. 
ECHO.           COMPILING ArrayPositions.java Program 
ECHO. 
C: 
cd \JumpStrt\Programs\ArrayPositions 
javac ArrayPositions.java 

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. 
ECHO.                       LOADING AnimateApplet.java Applet 
ECHO. 
ECHO. 
c: 
cd \JumpStrt\Applets\AnimateApplet 

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: 
cd \JumpStrt\Programs\ArrayPositions 
java ArrayPositions 

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  
            1.02 directory. 

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 
            new programming material. 

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  
           to change the directory to my new working directory. 

7th.  I open up my Programmer's File Editor (it is on the Quick Launch toolbar also) and  
           then load the compileit.bat and the go.bat (if a program) into the editor. 

8th.  I click into the compileit.bat file and then mouse the the last program name and then  
           click into the Edit/Replace function.  The moused file name will be in the find box  
            and then I type in the new file name in the replace box.  I then click on the replace  
            button and it will go to the next filename to changed until there are no more. I then  
            put a rem in front of the appletviewer line in the applet compileit.bat file.  I then  
            save the file and click into the go.bat file, if it is being used,  and then use  
            Ctrl-home to go to the beginning of the file. 
           I then click the find next button and replace the old names with the new one.  I then  
              save the go.bat file. 
 

 
 
 
 
 
 
 
 
 
 
 
 

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 
              If errrors pop up ( and they usually do), I alt-tab back to the editor and make the  
              changes and then alt-tab to the MS-DOS window and compileit again. 

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.

 
 
 
 
 
 
 
 
 
 
 
 

Index Page
This page hosted by    Get you own  Free Home Page

Copyright © 1998 by Daniel E. O'Rourke,  Hoopa, CA.   All rights reserved.