How to Use JCreator LE
- Downloading and Installing
- Configuring Default Properties
- Setting up Workspaces and Projects
- Entering and Running a Simple Program
- Choosing Which Program to Run
- Setting Up Command-Line Arguments
- Running Applets
- Adding jar Files to Projects
JCreator TM is a trademark of Xinox Software. JCreator LE is a simple Java IDE for Windows. You can download this freeware version of JCreator from jcreator.com. JCreator runs on Windows machines and requires Sun’s Java JDK (a.k.a. SDK) installed. Install the JDK and documentation first, then JCreator.
JCreator organizes your programs into workspaces and projects. A workspace contains one or several projects. A project contains one or several programs. For example, you can have a workspace for all the labs and exercises in one chapter of a textbook, and a project for a particular lab or set of exercises. You give names to your workspaces and projects.
Workspaces and projects are akin to folders and subfolders. In fact, it is customary to keep all the files for a given project in the same folder. The name of the project folder is usually the same as the name of the project. When you create a project, JCreator creates a folder for it, unless you choose an existing folder.
JCreator keeps the descriprion of a workspace in a file with the extension
.jcw. The projects within the workspace can be scattered on disk, but it is customary to group them as subfolders in the same folder. The
.jcw file can be placed in that folder, too. For example:
To create an empty workspace, first create a folder for your workspace using Windows Explorer (for example,
C:/mywork/JavaMethods/Ch03). Then open or return to JCreator, click on
File/New, and choose
You can add an existing Java source file to your project or create a new Java class (source file) from scratch. To add an existing file, go to
Project/Add files..., navigate to the folder that holds the file, double-click on the file (or single click and click
Open), then click on the
Add button. The file will be copied into your project folder and added to the project description. You can add several files at once from the same folder by clicking on them while holding the
Ctrl key down. If you need to add an
.html or a data file, choose
All Files in the
File Type pulldown list.
To create a new Java file, go to
Project/New class... or click on the
New class button on the toolbar. In the dialog box that pops up, enter the class name and check the desired options (such as “public,” “Generate main,” etc.) and click
Finish. For example:
To edit a file, double-click on its name in the file list on the left. Several files from the same or different projects may be open at the same time. You can choose one of them for editing by clicking on the corresponding tab below the edit window.
- Go to
Select “JDK Tools” in the left column and “Run Application” in the pulldown list
Click “<Default>”, click the “Edit…” button
Check the “Capture output” checkbox
- Open the class you want to run in the editor (or make it active by clicking on its tab), then go to
Build/Execute Fileor click on the
Execute Filebutton (right-pointing triangle with the document icon on the background).
- Click on the pulldown arrow next to the
Build/Execute Projectbutton and choose
Edit, and pick the default class to run from the pulldown list. For example:
- Create a new confiduration. Click on the pulldown arrow next to the
Build/Execute Projectbutton and choose
New, enter a nickname for your program and pick the class to run from the pulldown list. For example:
JCreator allows you to change the default run-time configuration for your program; in particular, it lets you set the command-line arguments. Click on the pulldown arrow next to the
Build/Execute Project button and choose
JCreator also allows you to define a number of “global” configurations. To do that, go to
Configure/Options menu and choose
JDK Tools. The dialog box that pops up lets you copy the default configuration under a different name and edit it. In particular, you can create a configuration that prompts you for command-line arguments each time you run a program. See JCreator‘s help (under “Contents/How to” look for “How to set the Main function arguments”). You can choose a “global” configuration you want to use for a particular project from the
Project/Project Settings... menu.
If your project contains an HTML file with an
<applet> tag, JCreator assumes that your project is an applet and automatically dispatches Applet Viewer for that HTML file when you execute the project. If your project has several executables, you can pick the HTML file as the default or one of the executable configurations.
In Java, it is common to combine several classes in one
.jar (“java archive”) file. Library classes are stored that way. Larger projects (such as the Case Study in the AP program) use jar files. You can create your own jar files combining several classes, too.
In JCreator you can simply add a jar file to the project. The procedure is the same as adding a Java file, except when you navigate to the folder where the jar file resides, choose
All files from the pulldown list.
The above method, however, copies the jar file into the project folder. This is wasteful if the same jar file is used with many projects. There is a more economical way. JCreator allows you to define a set of jar files under a single name of your choice. Once a set is defined, you can add the whole set to any project.
Open a workspace with a project. To define a set of jar files, go to
Project/Project Settings... and click on the
Required Libraries tab:
New... and in the dialog box that pops up enter a name of your choice for the set of jars, click on the
Classes tab, and click on the “Add >” button. The submenu that pops-up gives you a choice of adding a “path” (a folder that contains
.class files) or an “archive” (one or several jar files). Choose
Add Archive..., navigate to the desired jar file(s), then click OK. The selected jar file(s) is (are) added to the list. For example:
Repeat as necessary, then click
Click on the checkbox next to the jar set to add these jars to the current project. For example:
Once a set of jars has been defined, JCreator remembers it and makes it available to any project in any workspace. Check the checkbox next to a set’s name to add that set to the project.