FreeJava is an integrated development environment for Java programmers. It uses the tools available in the JDK (Version 1.x.x) from JavaSoft, but offers a more convenient Windows-based front end to the compiler, applet runner and runtime module supplied.
FreeJava was developed to let people take advantage of the fact that the JDK is free, and to encourage use of cross-platform, 100% Java available in Sun's free tools. For more information and a free download of these tools, please visit http://www.javasoft.com. This new version (2.0) aims to maintain and improve on the simplicity and ease of use of version 1 with new features previously only found in expensive commercial applications.
Please note that FreeJava is not developed or endorsed by JavaSoft or Sun Microsystems. Note also that FreeJava is a Win32 application and is not written in Java. It will run only on Microsoft Windows 95/98/NT platforms.
You may pass FreeJava along to anyone who wants it, but you may not do so for profit. You use FreeJava at your own risk, and the author takes no responsibility for any loss or damage caused directly or indirectly by the use or misuse of the program.
To compile and run Java programs with FreeJava, you must have a version of the JDK installed and correctly configured on your machine.
New features
Original features - still available
Many of the users of FreeJava 1.0 were kind enought to email me their wish-lists for features in a future version, which helped me to be able to concentrate on including the features people really want (rather than what I think they might want, or what's easy to do). In this version I have included practically everything requested - except that I know you'd probably like to see the Project Window in one of those toolbar-windows a la Visual C++, so that it doesn't disappear when you maximize a source window. So far, I haven't been able to figure out how to do it, but I'm working on it...
Run Setup.exe to install FreeJava. You can install the program wherever you like on your computer. The only important step once the program is installed is to choose "Preferences..." from the File menu, and enter the path to your installation of the JDK under "JDK Location". For example, on my computer the path is "C:\jdk1.2.2".
Incidentally, this means that FreeJava will also work with any version of the JDK, even future versions, so you don't need to get an update for your IDE every time there's an update for Java. FreeJava is optimized for use with version 1.2.2 of the JDK Java 2 platform.
There seemed to be only a few problems in the original version - the main one being that on Windows NT Server, and some installations of NT Workstation, FreeJava was unable to capture the output from the compiler or a running application for display in the process window. Also there was a problem with garbage characters appearing in the output. Now I have an NT machine, I've been able to fix all these problems.
Also, the text editor, although it autoindented with tabs ignored spaces - it now works with both. You will notice that the Project window now shows a much more interesting view of your classes and functions, and the way FreeJava parses files has been completely updated to cope with Java features and formatting as currently implemented. The parser now recognizes and deals with commented out portions of code correctly. There are still a couple of problems; notably it is unable to detect function declarations for interfaces. For most projects, this is not a big problem (to my way of thinking).
The "Convert Linebreaks" function is now available for both the HTML editors and Java editors, and works much better. It will convert text files in Macintosh or UNIX formats to PC format.
Substantial portions of the code have been rewritten, notably the source code editor with syntax colouring, and the project window with its class and function tree control, so watch out for new bugs, and let me know at bugs@freejava.co.uk.
1. STARTING A NEW PROJECT - APPLETS
To create a new applet project, click "New Project..." on the Project menu. In the dialog that follows, type in a name for your main applet class, and choose the "Applet Project" radio button. Then click "OK". FreeJava will then automatically generate a Java source file for your applet class, and an HTML file that can be used to launch the applet. You are prompted to save the project, and when you do you should create a new folder for it, since the Java and html source files will be saved in the same folder as the project.
You can then edit the Java file to create your own applet. You can add existing Java code files to the project by choosing "Add Java Source Files..." from the Project menu. Or you can open a Java source file and choose "Add Window to Project" from the Project menu. You can also do this with new Java source files created by choosing "New" from the file menu.
Choose "Build" from the Build menu to compile the applet, and "Run Applet" to execute the applet with the JDK's applet viewer.
NEW: If you want to see how your applet looks in your default web browser, open the HTML file and choose "Open in Web Browser" from the Build menu.
2. STARTING A NEW PROJECT - APPLICATIONS
Follow the same steps as in II.1. above, but instead of choosing "Applet Project" in the New Project dialog, choose "Application Project". FreeJava will generate skeleton code for a GUI Java application. You can compile the application by choosing "Build" from the Build menu, and run it with "Run". (The reason both "Run" and "Run Applet" area available on the Project menu is so that you can create FreeJava projects that are both applications and applets.
3. CREATING A PROJECT FROM EXISTING SOURCE CODE
Choose "New Project" from the Project menu, but this time choose "Empty Project". You will then be prompted for a place to save your new project. Add your existing files to the project by choosing "Add Java Source Files..." from the Project menu. When you want to compile and run the project, you must first set one of your source files as "Main". In the case of an application, this is the source file that contains the code for the "main" function. In the case of an applet it is the source file containing the code for the Applet-derived class. To do this, select the file in the Project window, and choose "Set as Main" from the Project menu. You can also do this by right-clicking on the file name in the Project window and choosing "Set as Main" from the pop-up menu. A small purple M on the file's icon signals its status. You can change which file is set as Main at any time. (When FreeJava runs javac, the Java compiler, it is always set to compile the class that is set as Main with the -depend flag set. In this way, all of the files needed to run the application/applet are compiled, and only those files.)
If you just want to compile a single file, open it or select it in the Project window, and choose Compile from the build menu.
At the top of each open source code-editing window is a drop-down list of all the functions defined in the open file. You can choose any of these functions to go straight to its definition in the source code. You can also double click on the file names, class and function names in the Project Window to open and go straight to the relevant code portion. If the line references in the Project window get out of sync with the line number in your code, just save your file, or choose "Refresh Function List" from the Edit menu (or press F2).
When you compile or run a Java program in FreeJava, all output that would normally go to a DOS mode terminal window is diverted to the process window. If you try to close this window before the process is complete, you will be asked if you want to terminate the process. You may need to do this, for example, if your Java program gets stuck in a loop, or if you have no code to close the main window of an application. Try to use this feature as little as possible, as it may fragment memory. If you single-click the icon on the left end of the Process Window's title bar, you will see menu options to save the content of the window (as a text file), and to set the font used to display the output.
The class and function listings in the project window are updated each time you open or save a source file, or when you click the drop-down function list. Click the + and - boxes to the left of the files and classes to expand them and view the function lists for each file. This provides a powerful way to view and understand your own code, and the code of others.
For more information on FreeJava
Visit the FreeJava web site at www.freejava.co.uk.
For more information on Java
For people who have some experience of programming but are new to Java, I would recommend Java In A Nutshell by David Flanagan, published by O'Reilly, and its companion volume Java Examples In A Nutshell. These books have the great advantage of being reasonably priced, and containing more useful information than much larger and more terrifyingly costly volumes. For absolute beginners, you could do worse than "Java For Dummies", widely available and instantly recognizable by its hideous cover.
Q. How do you work with packages in Free Java?
A. There is support for packages in FreeJava. Here's how it works:
Just specify the name of your package
in Project | Properties.
Q. Why can't I write applications that use keyboard inputs?
A.By capturing the output from Java in a window in the FreeJava IDE,
console input to applications run from within the FreeJava environment will not work.
However, you can write applications that use console input in FreeJava, but when
you run them you should choose "Run with Console" from the Build menu. Output capture to
the Process output window will then not be available.
FreeJava only syntax colours the line that you are editing, so if you comment out a large block of code using /* and */, you may then need to choose "Syntax Colour Update" from the edit menu (or press F3) to update the colouring. Also, if you open a file that is in Macintosh format, you may need to choose "Convert Linebreaks" from the edit menu before FreeJava is able to colour it correctly.
When you choose "Create Jar File" from the Project menu, FreeJava will create a Jar file containing every class that is in the same folder as your Main Class. It will also create a file (called "manifest.txt") that specifies the name of the main class, and include that with the Jar file so that, if your Project is an application you can run it from the command line with "java -jar MyApp.jar", where MyApp is the name of your jar file.
If you need to include other files or resources with your Jar file, you must do so manually, using the "jar" tool included with the JDK. More support for this feature will be coming in future versions.
You can see what files FreeJava put into the Jar file, by choosing "Show Archive Contents..." from the Project menu. The contents will be listed in the Process Output window (which will pop open).