JED Page

`JED` (Java EDitor)

JED is a front-end or user interface to Sun's JDK(Java Developers Kit).

This page explains what JED does and includes a tutorial that will teach you how to do it.

JED was developed with the 4.0 version of VB on Windows 95. But JED running on NT is currently untested.

JED is crude, but I like to think of it as simple and effective - like Java. It's basically a source code entry window that can save itself in a .java (source) file and then run that source file into the javac compiler. The output from the compiler (errors, etc) is saved and can be reviewed. If all goes well, the compiler creates a .class file that can then be run by the java interpreter or integrated into an .html (web page) file which can then be 'run' by the appletviewer. All of these tasks can be handled from within JED. This is especially useful for first time Java programmers who want to get some quick experience.

JED handles only one source file at a time. It is designed to reside and run in a directory along with some .java and .class and .html files. I call those directories 'working directories.' JED cannot open files outside of its working directory. Again, it's not very sophisticated.

This is my first experience using VB 4.X. It's a good tool, but there are many more kilobytes of runtime files required than in earlier versions. That's progress for ya.

JED.EXE and this JED.HTML file are Copyright(C) 1996, Matthew Grimm. Please use, copy and distribute them at will. I think Java would be an excellent language for an intermediate programming course and I would like to see it and JED get into the hands of anyone who wants to learn programming.

Java and the JDK tools are trademarks and the property of Sun Microsystems. My thanks to Sun for making the JDK available.

I would like to hear your opinion of JED. I'm open to any suggestion that might make JED better. I konw that there are some major shortcomings, and I'll do what I can to improve it. Email me, please.

That's all for now. Start coding.

Tutorial

Installing JED

The JED distribution comes in two parts: the JED.EXE file is in a .ZIP file called JED105.ZIP and the VB runtime files are in a file called VB40RUN.ZIP. I split them up so that you only have to download the VB runtime file once. Thereafter you can download the JED.EXE file as new updates appear. Installing is easy. First, unzip VB40RUN.ZIP in your \Windows\System directory. Then all you have to do is unzip JEDxxx.ZIP in a working directory and execute JED.EXE from there.

The JED execution environment

When JED runs the Java compiler or the interpreter or the appletviewer, it does so by executing a .BAT file that in turn calls these tools. Running a .BAT file causes a DOS box to be opened and the batch file to be executed therein. In order for the tools to execute correctly, a couple of 'environment items must be set correctly. If you've read the installation doc for the JDK for Win95 and NT, then you know how these environment items should be set. For review:

My CLASSPATH environment variable is set like this:

`SET CLASSPATH=c:\java\lib\classes.zip`

And my PATH includes:

`c:\java`

This is due to my to the fact that my \java directory, the directory that was built when I unpacked the JDK, is c:\java. If your \java directory is somewhere else, make the appropriate changes.

Whenever I read instructions like those just given, I get confused. If you don't understand the CLASSPATH and PATH items, please get some help from a competant Windows guru.

The test to see if your enviroment is set correctly is to open a DOS box and type these commands and look for these results:

Command: SET

Result: an environment vaiable called CLASSPATH that is set as described above

Command: PATH

Result: a PATH that include the path to your \java directory

There is a bit more to the environment. Some of the tools, like the java interpreter, will only check the CLASSPATH to find classes. So even if you run it in the same directory where your .class files exist, it won't see them. JED is designed to look in the current path, so that's not a problem. But just in case you have .class files somewhere else, there's a way to set the CLASSPATH inside JED. If you click on the Env button, it will disply a box that allows you to enter your PATH and CLASSPATH. Actually, what you put in there will be appended to your PATH and CLASSPATH when the tools run. If you're not sure what to put in, just leave them blank.

The secret inner workings of JED

How JED works is pretty amusing. When the Compile button is clicked, for example, the source code is dumped back into its file, the file is saved, a batch file called JEDCOMP.BAT is created which contains a call to the javac compiler`` and then JEDCOMP.BAT is executed. Running the appletviewer is accomplished is a similar manner. The result of using all these batch files is that the working directory fills up with lots of files. These files can be interesting. Check them out.

JED integrates with the JDK

As described in the previous section, JED is simply a front-end or user interface to the JDK tools. I want to explain in a little more detail what the JDK tools do and how JED works with them.

The JDK has three tools that are used to compile and execute Java programs:

javac - the Java compiler - compiles .java file, creates .class files

java - the Java app interpreter - runs .class files

appletviewer - the Java applet interpreter - runs .class files from inside .html files

If you didn't have JED or some other development environment, you could still use these tools to compile and run Java programs. You could use a text editor to edit the source code and then run the javac compiler against the source file. You could then take the .class files that come from the compiler and run them using the java interpreter OR, if the .class file is an applet, you could create an .html file that specifies which .class file to execute and then use appletviewer to 'run' that .html file.

But JED helps you do all that. It's a source code editor. It can call the compiler. It can run the interpreter OR it can create an .html file and then 'run' it using appletviewer.

Let's see how JED does all that.

Using JED

Here's a picture of the JED window:

When it's first run, JED only displays the New, Open and End buttons. Minimalism is cool.

- The New button creates a new, blank .java source code file that you can then edit.
- The Open button displays a list of existing .java files that can be opened (by double-clicking) and edited.
- The Save button allows the currently open file to be saved.
- The Print button prints the current file.
- The Compile button runs the javac compiler against the current file.
- The Tag button creates an .html file that points to currentfilename.class
- The View button takes the .html file that Tag made and runs appletviewer against it.
- The Run button runs the current app (not applet).
- The Output button displays the output from Compile in a window
- The Env button allows additional PATH and CLASSPATH items to be entered.
- The Notepad button runs Windows Notepad - useful for editing.
- The End button closes JED.

An example session

1) Click on the New button - enter the name of the .java source code file that you want to create - click on OK - now, move to the edit window and

2) Type in some applet code - try entering the code from in the JED window shown above

3) Click on the Compile button - this will start the compiler in a DOS window - when the DOS window disappers, click on the Ouput button - this will display the output from the compiler - look for errors

4) Click on the View button - this will display a box that says that currentfilename.html is ready to be viewed - click on OK - appletviewer will now run and display your applet

That's all for now

Please do send me some email if you have comments about JED.