Goto to Brian's BitBucket
Goto Brian's
BitBucket


Last Updated:
04/13/98 23:00

04/13/1998

JDEX -- Java Development Environment using Windows Explorer

J. Brian Coyle
mailto:brianc@magicnet.net

CONTENTS

INTRODUCTION
REASON FOR JDEX...
CHALLENGES AND SOLUTIONS
THE COMPONENTS
INSTALLATION OF JDEX
WORKING WITH JDEX
FAQ
COMING DISTRACTIONS
LINKS TO...
COPYRIGHT

Introduction

JDEX provides the tools to use Windows Explorer as a GUI front end to Sun's Java Development Kit. It is NOT a full featured Integrated Development Environment (IDE) nor is it a 'Visual' java development tool.

JDEX uses a few simple batch files and common Windows 95 components to create a simple and easy to use Java Development Environment.

I hope you'll find JDEX easy to use! Please send comments and suggestions to brianc@magicnet.net with "JDEX" in the subject line.


Reason for JDEX...

When I first began to pick up and learn Java, I quickly became tired of the DOS command line interface under Windows 95. After all, Windows is a GUI environment, isn't it? I suppose I have become spoiled by the GUI. I also wanted to learn Java, not the intricacies of a complicated JDE or IDE.

I envisioned using Windows Explorer as a graphical front-end to the JDK. I felt it would be a simple matter to associate the ".java" and ".class" file types with the various components of the Sun Java Development Kit and an editor of choice. Using this method, I could simply double-click or right-click and select the appropriate actions. Of course, things are never quite this easy...


Challenges & solutions

Associating the .java file type with an editor (I use Wordpad) turned out to be the simplest task. I soon discovered several idiosyncrasies of Windows 95, the MS-DOS environment, and even the JDK.

First, I found that Windows Explorer passes file names to DOS in the 8.3 format. This of course would not do as the JDK expects long names.

The next challenge I encountered was the Java interpreter. Not only does java expect a long filename, it doesn't want the drive\path or ".class" extension attached. This makes sense when you realize the interpreter is looking for a classname, not a filename.

Later, I discovered early versions of Appletviewer would not properly handle file names with a drive\path. This has been corrected in the 1.1.5 JDK.

The solution to each of these challenges was to create some DOS batch files to act as the go-between for Explorer and the JDK components. The real trick would be to write the batch files to be generic and reusable. So that's what I set out to do. Along the way, I refreshed my DOS skills and learned many new tricks, tips, and techniques -most from the contributor's of the alt.msdos.batch newsgroup. A hardy "thanks" to all the unknowing assistants!

The components

JDEX consists of several components; the installation file system, the JDEX directory and files, the PIF properties for the batch files and finally the Windows Explorer associations for the ".java", ".class" and ".html" extensions.

Here’s a diagram of of my directory structure


Dir JDK
\JDK
  |
  +--1.0.2        }
  +--1.1.5        }  Various JDK's
  +--1.2.beta3    }
  +--etc          Misc. documentation, tips, etc.
  +--jdex         JDEX
  |   |
  |   +--docs
  +--langspec-1.0 Sun's specification for java
  +--MyCode       My java code-
  |   |
  |   +--Applets     Applets
  |   +--Classes     Fully tested Classes
  |   +--HTML        HTML files
  |   +--JavaDoc     JavaDoc documentation
  |   +--src         source code and classes in progress
  |
  +--Tutorial        Sun's java tutorial


On my desktop, I keep a shortcut to the \JDK directory. Clicking on this icon will open a copy of Explorer which I use as my Java Development Environment.


JDK desktop

The icon I selected for the shortcut is the "folder with the tools" from \WINDOWS\SYSTEM\SHELL32.DLL (icon #37).

The command line parm for this shortcut is:

C:\WINDOWS\EXPLORER.EXE /e,/root,"D:\JDK"
,/select,"MyCode\src\java shell.java"

Notice my JDK is installed on my D: drive, but it can be located anywhere. The /select parm causes Explorer to automatically select the specified file in the right pane. I use "java shell.java" which is my generic java source file. This allows the JDK path to be rooted in the left pane, while the right pane traverses into my source code directory.

JDEX has several primary batch files providing the interface between Explorer and Sun's Java commands.

	- "Java Console.bat"
	- "Java Compile.bat"
	- "Appletviewer.bat"
	- "JavaDoc.bat"

The "Java Console.bat" file provides double duty, both running java classes and supplying a consistant command line interface for the JDK.

In addition to the primary batch files, there are a few supporting batch files:

	+ setjde.bat		Set java development environment
	+ setfn.bat		Set long filename
	+ rmvpath.bat		Remove path from filename
	+ rmvext.bat		Remove extension from filename

Key to the proper and seamless interface of JDEX and Explorer are the PIF properties for the primary batch files. These can be set by right clicking on either the .BAT or .PIF file and selecting properties.

- important PIF file properties
  + Batch file          (setjde.bat) runs prior to the command
  + Command line        (fully qualified path to batch file)
  + Close on exit       (checked)
  + font                (8x12)
  + Initial environment (4096)
  + Window
  + Initial size        (50 lines)
  + show toolbar
  + Quickedit

Here's an example of the PIF properties for "Java Console.PIF". Remember to set the program and batch file paths to your installation location.


PIF properties - program

PIF properties - font


PIF properties - memory

PIF properties - screen


PIF properties - misc.

Installation of JDEX

The installation of JDEX consists of four simple steps; creating the JDK directory structures, installing the JDEX files, editing the setjdex.bat file for your environment, and creating the Explorer file associations.

- JDK

The JDK directory structures are created when you install Sun's Java Development Kit. I prefer to keep a current JDK along with the previous major and latest bleeding-edge beta JDK. As of this writing, I have the 1.0.2, 1.1.5, and 1.2.beta3 kits installed (see the example of my JDK layout above).

- JDEX directory

The JDEX directory contains the batch files and documentation. It is installed directly from the JDEX.ZIP distribution file.

- edit the setjdex.bat file

The setjdex.bat file is used to set various environment variables for your particular installation and preferences. By using a separate, transient batch file, it is not necessary to permanently set the values in AUTOEXEC.BAT

- create associations

Probably the most important piece to JDEX is the Explorer file associations. Setting the associations for ".java", ".class" and ".html" extentions allows Windows Explorer to function as the front end to the Java Development Environment.

File associations are modified by clicking on "View | Options" from the Explorer menu, then selecting the "File Types" tab.


File Types



After selecting a file extention from the resulting dialog window, click "Edit" to set the following:




Edit File Type


Edit Open



Edit Compile


File type Action application used to perform action
JAVA Source-file
".java"
Open"C:\Program Files\Accessories\Wordpad.exe" "%1"
Compile"D:\JDK\jdex\Java Compile.pif" "%1"
create JavaDoc"d:\jdk\jdex\javadoc.pif" "%1"
Edit with NotepadNotepad.exe
Java Class
".class"
Open "D:\JDK\jdex\Java Console.pif" "%1"
Netscape (or MSIE) Hypertext document
".html"
View with Appletviewer "D:\JDK\jdex\appletviewer.pif" "%1"

Working with JDEX

Working with JDEX is designed to be very simple. The familar Windows 95 Explorer provides a GUI, point-and-click front-end to the java source code, classes and HMTL documents. Double clicking a file causes Explorer 'open' the file using the default application.

By right-clicking a file, Explorer will present a context menu from which various other actions can be selected. For example, JDEX specifies several Explorer actions for a ".java" file. The file can be opened for editing, compiled into a ".class" file, edited with an alternate editor (such as Notepad) or used as input to the JavaDoc tool.


.java context menu

FAQ

Q: Why am I getting an error "Cannot find ?????.bat" when clicking on a .java or .class file?

A: Be sure the PIF file properties for both "Command Line" and "Batch file" include your full path to the JDEX batch files.

Q: Why are my environment variables set incorrectly (or not at all)?

A: Be sure the "Initial environment" in the PIF properties is set to a large enough value. The recommended value is 4096, unless your system is memory constrained.

Coming distractions

- automatic installation and registry updates

   + INF file to prompt for and create directories then 
     install the JDEX files   

   + INF file to create PIF files (\windows\apps.inf ??)
     based on installation directories

- passing additional command line parms
- additional batch files for other java commands
- improved documentation

Links to...

JDEX information is available at http://www.magicnet.net/~brianc/JDEX

The latest distribution file can be downloaded from http://www.magicnet.net/~brianc/JDEX/JDEX.ZIP

Copyright (c) 1998 by J. Brian Coyle

JDEX is provided without cost for private, non-comercial use. Refer to the JDEX\copyright.txt file for full details.