The Decaf Java Editor was conceptualized on Saturday March 11, 2000 A.D. Programming started the next day. I had just gone to a Java conference on Saturday March 11, and working with only the JDK (now know as the Java 2 SDK) was a real pain. So I came up with this freeware solution. With Decaf, you can write, compile, run, run in the appletviewer, and run in your browser your applets AND, Decaf will generate the HTML file with a custom <APPLET> tag all from with the same program! I finished all of the main functionality in no more and no lass than one week! I finished up that last bit of get the Compile function to work during the conference the next Saturday (the 18th). This is my first real experience in Java, though I am already familiar with other programming languages (C, C++, Perl, HTML, and JavaScript to name a few) so any suggestions are welcome.
Everything!! (j/k)
I fixed a bug that printed out the EOF character onto the screen. This used to mess up compiling. In the Info Menu. I added a total line counter and function that tells you what line the cursor is at.
If you downloaded the uncompiled version, unzip it and go to its directory. Type:
javac Prefs.java and javac -classpath .\ decaf.java
Getting started with Decaf might be a hastle, but hopefully it won't. First make sure that you have the latest version of the Java Sofware Development Kit (Java SDK). Decaf cannot run without it!. Decaf uses some of the programs from the SDK to provide much of the functionality that Decaf provides. (For example, to compile a program, Decaf calls javac in the bin directory of the SDK. Naturally, different people install the SDK in different directories. Therefore, you should go to the Info menu and select Prefs and enter in the paths for the programs listed.
Though not necessary, Decaf should be unzipped into its own directory. To run Decaf, go to the command line and get in the directory that Decaf is in. Then type:
java decaf
Naturally calling java from the correct directory. You can supply an optional file to be opened automatically:
java decaf project3.java
You cannot, I repeat, can not be in a different directory that your class file is in when running it with java! For example, following will produce an error!:
C:\WINDOWS>c:\jdk1.2.2\bin\java ..\my_java\class1
This will cause many "errors" in Decaf. This is why your programs are not running from within Decaf.
The other thing that may be confusing is the way Decaf handles files. When you start up Decaf, you will see a text field labeled: Current Path / File: You type in the full path name, or relative path name in here, then go to the File Menu and select Open. This will open the file that you just typed in. Concerning the full path names, Netscape doesn't seem to like it when running applets. I plan to fix this in future versions. To Save your file, type in the path in the Path field, go to the File Menu and select Save. If you already typed in the file path/name then you obviously don't need to retype it all in. To use the "Save As" function that many word processors have, just change the path/file name in the Path field and select Save. All Save really does is take the path in the Path field and write the contents of the editing field to that path.
The New command creates a new, untittled file. In version 1.0, all it does is clear the editor field and the path field.
The Open Command opens a file and displays its contents in the editor field for editing. To open any plain text ASCII file (not just *.java or *.txt), type in the full path or relative path into the path field and select this command from the file menu. You can also open a file passed as a command line argument to Decaf:
C:\JDK1.2.2\DECAF>..\bin\java decaf myfile.java
The Save Command could also be labeled as the "Write to File" command, because that is all it really is doing. It takes the path in the path field and writes the contents of the editor field to tha file.
Close closes the current file and clears the path and editor fields.
Quit was the first commad I programmed into this program. Yes, it's true. This complex Java Editor was at one time just a window with a "Quit" button. One thing to note: Decaf v1.0 does NOT ask you if you really want to quit if you have not saved your file! This will change in later versions.
Compile calls javac in the bin directory of the JDK. It uses the "-Xstdout" argument to read in the compiler errors that javac would usually write to Standard Error. This option redirects the compiler output to Standard Output so Decaf can display the errors conviently. If you have no idea what I'm talking about here, don't worry, it's not on the test. Don't forget to Save your file before compiling! Compile passes the saved file to javac to be compiled! It does not touch the editor field's contents!
To specify your own arguments for javac append them to the javac path in the Prefs menu item.
This command runs your Java class as an Application. It calls java in the bin directory of the JDK and passes your class as the class to run. Don't forget to first Compile your Java class. One important thing to note: with java, you must be in the same directory as the class file in order to successfully run the class file. That basically means: you can only run your program if it is in the Decaf directory! In later versions of Decaf, I hope to circumvent this issue.
In order to use this function, you must first use (at least the first time for each class) the Generate HTML command. This command opens the appletviewer in the JDK. It passes along the HTML file generated by that command. Don't forget to Compile first, too. To set custom <APPLET> tags, see the section on setting the Prefs.
This command is identical to the Run in Appletviewer command except it opens your browser (the one specified in that field in the Prefs section). There are a few problems with paths with this command, but these will be fixed.
The Generate HTML command generates a bare-minimum HTML file that can be used by both the Run in Appletviewer command and the Run in Browser command or you can use it to quickly create a HTML file to post your applet on your web server. You can always edit the HTML file later with an HTML editor to fit it in with the rest of your webpages on your server.
If you run this function and you get a Java Core Dump, try using "./your-file.java" instead of "your-file.java". It seems to work.
The prefs section is used to set the preferences and environment variables. The first 4 fields, "Java Path", "JavaC Path", "Appletviewer Path" and the "Browser Path" are used to specify the paths to these files. You can also use these fields to specify command line arguments. Decaf uses these fields by getting their value and using that value to run the program. That is why you can put in command line arguments. If you want to use a different browser, just type in the appropriate path in field. Decaf doesn't know the difference from one field to the next. It just takes the value and executes it.
The "Applet Tag" is used by the Generate HTML to specify a custom <APPLET> tag. Type in any parameters that you want. The start tag and close tag are already there. You can also specify <PARAM> tags for your applet. Just type them in after the ">" of the start tag. Don't forget to specify a height and a width. Those are required fields!
The "Cols" Field and the "Rows" field are used to specify the cols and rows of the editor field in the main screen. Restart Decaf to use any new values.
The "Done - Save Prefs" button writes the prefs to a file. In other words, saves the prefs. The "Cancel" button does not record any changes, but still closes the Prefs window.
If you mess up the Prefs file in any way, you can always download it again or delete the file decaf.prefs. This will cause Decaf to use the default prefs and create a new Prefs file.
Displays the line number that the cursor is currently on
Displays the total number of lines that the currently opened document has
Brings up this help text in the browser specified in the Prefs section.
Tells you that Decaf is under the GNU General Public License
Copyright (C) 2000 2Slickk Software Co. (2Slickk@bigfoot.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
All and any comments and suggestions are welcome: You can email me at Anathoth@bigfoot.com. Submit all bugs here, too. Our website is at https://anathoth.tripod.com/
Submit all bugs to me at Anathoth@bigfoot.com.
This program is dedicated to the Glory of God and of His Son, Jesus Christ who died willingly on the cross for the sins of me and all man-kind. For more information, go to http://www.NeedHim.com
© 2000 Anathoth Software. Distributed under the GNU General Public Lisence. Java is a trademark of Sun Microsystems.