Setting up jEdit for Compiling Java Code
Note: I only
know how to barely make these programs work. If you ask me about specifics, then
I probably can't help you.
Helpful Links
- jEdit
- JSwat
Tutorial (This tutorial isn't really designed for the jEdit version of
JSwat, but it may still be helpful.)
Suggested Plugins (Go to the Plugins menu in jEdit and
select Plugin Manager. From there you can easily install plugins. Don't bother
trying to download them from the web page.)
- JBrowse - Helps you to navigate your Java code.
- JCompiler - Allows you to easily compile your file from the Plugins menu.
- JSwat - A Java debugging interface. (It needs the Common Controls plugin.)
- XML - Helps a little with editing html code.
- There are some other neat looking plugins that you may want. You should
browse the list of plugins yourself.
Preparing jEdit for Windows
- From the Start Menu, select All Programs->jEdit->Set jEdit
Parameters
- For the "Location of Java application loader" option, choose the javaw.exe
file in your Java SDK directory. (For example, mine is
"G:\j2sdk1.4.1_01\bin\javaw.exe".)
- Running off of the SDK version of javaw.exe may help with some plugins.
Using JCompiler
- Open your Java code file in the jEdit text window.
- Goto the Plugins menu and select JCompiler->Compile File.
- The file will automatically be compiled and placed in the directory with
your Java code.
- By default, the code is compiled with debugging information. You can
change this by selecting JCompiler->JCompiler Options from the Plugins
menu.
Setting up JSwat
- Goto the Plugins menu and select JSwat->Show Options.
- Set the options as follows:
- Java home: You need to type in your Java SDK directory. (For
example, "G:\j2sdk1.4.1_01".)
- Java executable: java
- JVM parameters: -classic (Actually, this is just the default
setting.)
- Class name: The name of your class. (For example, if you download
the tutorial.java
code (from the JSwat
Tutorial page) and compile it, then you would enter "tutorial".)
- Application parameters: Any console parameters for your program.
(Typically blank.)
- Class path: Specify where your class files that will be debugged
can be found. (If you have spaces in your path, then be sure to put double
quotes around your path. Also, if you use the "..." button to select your
path, then be sure that it outputs correctly. I was having problems with the
last directory in the path showing up twice, so the debugger couldn't find
the directory. If it is incorrect, you will have to edit the path manually.
An example path would be "F:\Java\tutorial".)
- Source path: Specify where your java (source) files that will be
debugged can be found. (This is most likely the same as the previous option
unless you are more organized than I am. An example path would be
"F:\Java\tutorial".)
- Start VM suspended: When checked, the dubugger will start
suspended.
- Show options before starting: When checked, this dialog will open
when you try to start debugging.
Quicky JSwat for jEdit Tutorial
- Download the tutorial file and save it in a directory: tutorial.java
- Open the file in jEdit.
- Compile the file using JCompiler as explained above.
- Click on line 12 of the source file: pushCount++;
- Goto the Plugins menu and select JSwat->Add Breakpoint. A red mark
should appear next to the line.(This adds a breakpoint to your program, you
select Remove Breakpoint to remove it.)
- Goto the Plugins menu and select JSwat->Start/Resume VM.
- The JSwat Options dialog will pop up. Make sure everything is setup
correctly (as explained above), then press Ok.
- The JSwat debugger will start suspended. Press the "vmResume" button at
the top of the JSwat window.
- Wait a moment for all of the threads to start. Several should fill the
area below the "Threads" tab.
- The tutorial window should appear somewhere on your desktop. Find it and
click on the big "Push me" button.
- The program should have stopped on the line with a breakpoint and that
line should be highlighted.
- Click the "Locals" tab at the top of the JSwat window.
- Open up the "this (tutorial)" object by clicking on the circle next to the
folder icon. Notice that the variables in your object can be viewed here.
"pushCount (int)" is currently 0. (The variable type is shown in the
parantheses.)
- Click the "next" button at the top of the JSwat window.
- Open up the "this (tutorial)" object again. Notice that "pushCount (int)"
is now 1.
- Click the "next" button a couple more times.
- Notice that more local variables show up under the "Locals" tab; you can
observe these too.
- Click the "vmResume" button to continue the execution.
- Close the tutorial window.