![]() ![]() Goto Brian's BitBucket Last Updated: 07/16/98 22:30
|
JDEX -- Java Development Environment using Windows ExplorerJ. Brian Coylemailto:brianc@magicnet.netCONTENTSINTRODUCTIONREASON FOR JDEX... CHALLENGES AND SOLUTIONS THE COMPONENTS INSTALLATION OF JDEX WORKING WITH JDEX FAQ COMING DISTRACTIONS LINKS TO... COPYRIGHT IntroductionJDEX 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 & solutionsAssociating 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 componentsJDEX 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 ![]() \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. ![]() 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 consistent 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. ![]() ![]() ![]() ![]() ![]() Installation of JDEXThe installation of JDEX consists of five simple steps; creating the JDK directory structures, installing the JDEX files, editing the setjde.bat file for your environment, creating the Explorer file associations, and setting up shortcuts. - 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 setjde.bat file The setjde.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" extensions 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.
![]() After selecting a file extension from the resulting dialog window, click "Edit" to set the following: ![]() ![]() ![]()
- setup shortcuts The final step to installing JDEX is to create shortcuts to a few pieces of JDEX. Depending on your work habits and preferences, you can place the shortcuts on the desktop or on the Start menu.
I recommend the desktop shortcut to launch Windows Explorer and a Start Menu program group with shortcuts to "JDEX\docs\changes.txt", "JDEX\copyright.txt", "JDEX\docs\index.html", "JDEX\Java Console.PIF", and "JDEX\docs\README.txt". The JDEX.ZIP distribution contains a "JDEX Shortcuts" directory which
can be copied to "\Windows\Start Menu\Programs". If you have implemented
user profiles, the destination directory will be
"\Windows\profiles\xxxx\Start Menu\Programs" (where xxxx is a profile name).
![]() Working with JDEXWorking with JDEX is designed to be very simple. The familiar 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. ![]() To launch JDEX, double-click the desktop shortcut or start Windows Explorer and traverse to your JDE source code directory. Select a java source file and make changes if necessary. Save the file, then from the Explorer window, right click on the file and choose "Compile". This will launch a DOS window and execute the compiler. If there are any errors, a listing file (named filename.txt) will be generated and displayed in the DOS window. This file is not deleted after closing the DOS window, so it can be viewed again from Explorer. A successful compile generates the .class file which can be run by double-clicking the file in Explorer. Remember, your class must be created as an application to run standalone. When the application terminates, the Java Console remains open. This allows for review of the program output and the execution of other commands. To close the Java Console window, type "EXIT". To test an applet, right-click on the HTML file, and select "View with Appletviewer". For those occasions where you need to work from the command line, simply launch "JDEX\Java Console.bat". FAQQ: 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. Q: Will JDEX work with Windows NT? A: The techniques used by JDEX can be used, however, some of the batch files will require modification. For example, the trick using the MODE command in rmvext.bat doesn't function properly. Fortunately, WinNT provides much improved variable substitution and scripting tools. To extract a file name from "%1", it is simply a matter of specifying "%~n1". For details on some of the advanced WinNT scripting and variable substitution, type "for /?" at a command line. Q: Does JDEX work with non-English versions of Windows 95?
The trick to remove the extension from the file name uses the MODE command output (which generates "Invalid parameter - xxxx" in English). If you are using a non-English version of Windows 95, this text might be different and could cause a problem. The solution was to modify the rmvext.bat file to be independent of the language of the output. Current versions of JDEX should work with non-English versions of Windows. Please report any difficulties via email with "JDEX" in the subject line. 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 CoyleJDEX is provided without cost for private, non-commercial use. Refer to the JDEX\copyright.txt file for full details. |