Using UltraEdit to compile Java source
This document is only for those of you who want to use UltraEdit to compile Java source

Java programmers are free to use a variety of Integrated Development Environments (IDE) on the market. We recommend using Eclipse (www.eclipse.org) . See Eclipse Notes

STOP READING UNLESS YOU WANT TO USE ULTRAEDIT TO COMPILE JAVA SOURCE

Once upon a time, I used Sun's command line compiler javac and UltreEdit, which is a nice scriptable text editor.   In this document, I describe how my hard drive and work environment was organized.

I also show how I use the text editor UltraEdit to launch compilation and runtime scripts directly from within the editor.  These comments, specifically for UltraEdit, should be applicable to most editors that offers the programmer the ability to run macros.

I created a directory on my G: partition called jwork.  Everything I do in Java goes in here.
Inside jwork I have a directory called classes.  All my class files get compiled into this classes directory ( the –d <dir> option for javac compiles .class files to the specified directory)

I installed jdk1.3 to H:\jdk1.3

All my comments below will be specifically based on my using these partitions and directory names; you may use whatever partitions and names you like of course (I avoid the system disk C: and set up other partitions to stay out of its way)

I created a “batchfiles” directory on my C: partition, where I install a few convenient shortcut scripts you’ll see below, called jm.bat (runs java) and jmc.bat (runs javac)

Note on JMSL Plugins: JMSL plugins provides a uniform way for developers to distribute classes to JMSL Score users.   As of JMSL v1.02,  Score autodetects relevant classes found in the jmsl_plugins directory.  The jmsl_plugins directory must therefore be explicitely added to the classpath passed to java.


In my autoexec.bat I set up a few environment variables like so:

SET JDKHOME=H:\jdk1.3
SET JWORK=G:\jwork
SET CLASSES=%JWORK%\classes
SET PATH="%PATH%;%JDKHOME%\BIN";C:\batchfiles
Notice that I do NOT have an environment variable called CLASSPATH.  Having one caused enough confusion among web browsers that I eliminated its use.

If you get an "Out of environment space" error when rebooting, add the following line to your config.sys file in order to increase the environment space:

shell=c:\command.com /e:4096 /p




I created a batch file called jmc.bat, which invokes the javac compiler with classpaths set up properly.  jmc.bat has one and only one line in it:
javac.exe -deprecation -classpath %CLASSES%;%CLASSES%\jmsl.jar;%CLASSES%\jsynclasses.jar;pathto\jmsl_plugins -d %CLASSES% %1.java


I created a batch file that invokes the java runtime, similarly, called jm.bat, which reads (one line):
 

java.exe -classpath -classpath %CLASSES%;%CLASSES%\jmsl.jar;%CLASSES%\jsynclasses.jar;pathto\jmsl_plugins %1 %2 %3 %4


I put both these batch files into c:\batchfiles


At this point you could compile Hello.java by cd'ing to the directory containing Hello.java and typing:
jmc Hello
...at an MSDOS prompt, assuming you were cd'ed to the directory containing Hello.java

You could run this by typing:
jm Hello
...at an MSDOS prompt, from any directory

…or, if it’s in a package (recommended, and is included in this distribution), by typing:
jm mypackage.Hello
 
 


ULTRA EDIT NOTES








But why type at a command line when you could run these from UltraEdit?
Download UltraEdit from www.ultraedit.com

In UltraEdit, under Advanced\Tool Configuration, create a new command, called, say “JAVAC”
Under command line, type
C:\batchfiles\jmc.bat %n

For working directory, type:
%P

Check "Save all files first"
Check Output to list box
Check capture output

This lets you compile a java source file directly from within UltraEdit, capture errors, and be able to click on an error message, then jump to the offending line

Since we're always going to use packages, here's how you set up a script to allow you to first highlight the name of the package in the source file, then run java on it.
In UltraEdit, under Advanced\Tool Configuration, create a new command, called, say “JAVA Package Select”
Under command line, type
C:\batchfiles\jm.bat %sel%.%n
For working directory, type:
%P
Check output to list box and capture output.
 

If you want to create another command that runs java on non-packaged classes, just remove the  %sel% from the above.

Good luck!
D

--

One more tool, which lets you run Appletviewer directly from within UltraEdit, on the current HTML file that is loaded into UE

In UE's Tool Configuration, make a new tool.

Command line:
APPLETVIEWER %n%e

Working directory:
%P

Menu Item name:
Applet viewer (or anything you like)

Output to list box and capture output both checked.

Just to be clear, you will have to have the html file saved in a place that is correct relative to the applet class you want to run.  The Applet of course has to already be compiled.  Then you just run this tool on the html file directly from within UltraEdit.  Nice.

Note that this does not work with JSyn applets since appletviewer does not load the plugin.  Use Phil's AppletFrame class and main() to test JSyn applets.
  Installation Page
JMSL Home