Streamline Your Java Development With Jcreator Ide: Jcreator User ' S Guide
Streamline Your Java Development With Jcreator Ide: Jcreator User ' S Guide
Streamline Your Java Development With Jcreator Ide: Jcreator User ' S Guide
Java Development
With JCreator IDE
Copyright Information
Barry Devlin owns the copyright to this manual, with all rights reserved.
Xinox Software owns the JCreator trademark.
Barry Devlin,
5930 Porto Alegre Dr,
San Jose, CA 95120
TABLE OF CONTENTS
GETTING STARTED.....................................................................5
Checking Your System Requirements............................................5
Downloading the JDK.....................................................................5
Installing the JDK...........................................................................6
Setting up JavaClass Documentation.............................................6
Downloading the JCreator IDE Software.......................................6
Installing the JCreator IDE Software.............................................7
COMPILING A SIMPLE JAVA PROGRAM.....................................9
Navigating the JCreator Workspace..............................................9
Creating the Project.....................................................................10
Editing the Source File................................................................10
Compiling the Class.....................................................................11
Executing the Program................................................................11
CUSTOMIZING YOUR WORKSPACE.........................................13
Setting General Preferences........................................................13
Changing the Default Project Directory.................................13
Prompting for Main Arguments..............................................14
Setting Editing Preferences.........................................................15
Inserting Brackets Automatically...........................................15
Setting Auto Code Completion...............................................15
Customizing Menus and Toolbars................................................16
Changing the Context Menu..................................................16
Adding Commands to a Toolbar.............................................17
Adding Commands to a Menu................................................17
Changing Commands in a Menu............................................18
Creating and Changing Command Shortcuts..............................19
CREATING A JAVA APPLICATION.............................................21
Organizing Your Files...................................................................21
Creating a Workspace..................................................................21
Creating Projects.........................................................................22
Accessing JDK Documentation.....................................................22
Creating a Project Template........................................................23
Setting the Class Path..................................................................23
Debugging Your Code..................................................................23
Setting a Breakpoint...............................................................24
Examining a Class Variable....................................................24
Packaging Your Application.........................................................24
INDEX....................................................................................... 25
GETTING STARTED
GETTING STARTED
This chapter describes how to download and install the JCreator
software, as well as required software from the Java web site.
The JCreator IDE uses tools from the Java Development Kit
(JDK). JCreator also uses the Class documentation from the Java
site. Therefore, you must download and install both of these
items prior to installing JCreator.
C h e c k i n g Yo u r S y s t e m
Requirements
Ensure that your PC meets the minimum system requirements
for the JDK and JCreator, by referring to the table below.
JCreator System Requirements
Program
JDK
JCreator
RAM
40 Meg
64 Meg
Disk space
150 Meg
10 Meg
Windows
versions
supported
Win98 (ver 2),
Win2000, and
WinXP
Navigate to http://java.sun.com/j2se/downloads/index.html.
Select J2SE 5.0.
Select the latest available version of the JDK.
Select the Accept License Agreement checkbox.
Click Windows Online Installation, Multi-language.
A File Download dialog box opens.
6. Click Save.
A Save As dialog box opens.
7. Navigate to the directory where you want to save the
installation file.
8. Click Save.
7
GETTING STARTED
Setting up JavaClass
Documentation
Download Java Class documentation from the Java web site as
follows:
1. Navigate to http://java.sun.com/j2se/downloads/index.html.
2. Click on the Download button next to J2SE 5.0
Documentation.
3. Click on J2SE(TM) Development Kit Documentation 5.0,
English.
4. Select the Accept License Agreement checkbox.
5. Select Windows Online Installation, Multi-language.
A File Download dialog box opens.
6. Click Save.
A Save As dialog box opens.
7. Navigate to the directory where you want to save the
installation file.
8. Click Save.
The installation file downloads to the location specified in
step 7.
Install the documentation as follows:
1. Double-click on the installation zip file.
2. Click Extract Files, in the File menu.
This launches a wizard to extract the files.
3. Use the wizard to extract the documentation files to folder:
C:\Program Files\Java\jdk1.5.0_05\docs
10
GETTING STARTED
11
C O M P I L I N G A S I M P L E J AVA
PROGRAM
This chapter describes how to create a simple program in the
JCreator IDE, and how to compile and execute this program.
N a v i g a t i n g t h e J C r e a t o r Wo r k s p a c e
The JCreator IDE workspace contains four main frames,
presented in a standard Windows window. JCreator refers to
these frames as views, as each frame presents a different
viewpoint into the project.
The four views present the following information:
File view
Explorer-style view of the files in your workspace
Properties view
Method names and class variables defined in this project
Output view
Output from compiles, builds, searches, and debug
commands
Edit view
An editing environment for Java code files, and other files
E d i t i n g t h e S o ur c e F i l e
The Project Wizard created the Java source file for your class.
Edit this file into the traditional Hello World program, by
following these steps:
1. Double-click on the file name (in the file view) to open this
file.
JCreator Users Guide
14
GETTING STARTED
2. Add a blank line in the Main method, below line 11.
3. Type in the following code:
System.out.println("Hello World");
16
18
GETTING STARTED
19
With this option turned on, a dialog box opens when you
execute your program. Enter the Main argument values in the
text line, and click OK.
S e t t i n g Ed i t i n g P r e f e r e n c e s
You set editing preferences via the Options dialog box. Click on
a topic in the list (e.g. Editor\Java\Colors) to display the options
for that topic.
20
GETTING STARTED
1. Type the first letter or numeric.
2. Hold down the Control key and hit the space bar.
A scrolling window opens, showing candidate classes and
methods.
3. Type in additional letters to narrow down the selection.
4. Double-click on the desired selection in the scrolling
window.
The selected text now appears in your source code.
C u s t o m i z i n g M e n u s a n d To o l b a r s
You can customize any of the menus and toolbars via the
Customize dialog box, which displays a tab for each of the
main types of settings (see the following screenshot).
A d d i n g C o m m a n d s t o a To o l b a r
1. Click Customize in the Configure menu.
This opens the Customize dialog box.
2. Click All Commands in the Categories list.
3. Drag any entry from the Command list to a location in the
toolbar, and release the mouse button.
That toolbar location now contains the command.
4. When you have finished adding commands, close the
Customize dialog box.
22
GETTING STARTED
23
24
C R E AT I N G A J AVA A P P L I C AT I O N
O r g a n i z i n g Yo u r F i l e s
JCreator provides two mechanisms to keep your files organized:
workspaces and projects.
A project defines the set of source files that you want to edit
and compile at the same time, and that you want to package
together in a Jar file. Therefore, create a project for each of
your Java programs (i.e. top-level class plus any supporting
classes). Also, create a project for each Java package that you
implement.
A workspace groups together a number of related projects.
Therefore, create a workspace to contain a library of Java
packages (each package being a project). Also, create a
workspace for a large software application (each program in
the application being a project).
C r e a t i n g a Wo r k s p a c e
To create a new workspace:
1. Click New/Blank Workspace in the File menu.
A New Workspace dialog box opens.
2. Type in the name for this workspace, and change the
location of the Workspace, if desired.
JCreator creates a new folder (with the same name as the
workspace) in the location that you specified.
Creating Projects
To create a new project:
1. Click New Project in the Project menu.
The Project Wizard dialog box opens.
2. Select the template appropriate for your project (see table
below), and click Next.
Template choices
Template
Basic Java
Application
Basic JFC
Application
Basic Java
Applet
Empty
Project
Project
type
User
Interface
(using AWT)
Java
Package
Java Applet
Any other
project type
Files Created
Main class and a simple
AWT frame
Main class (includes a
Package statement) and a
simple AWT frame
An Applet class and an
HTML test file
No files created
GETTING STARTED
2.
C r e a t i n g a P r o j e c t Tem p l a t e
You can set up your own project template, to save time when
creating multiple projects of the same type. Use the following
steps:
1. Navigate to C:\Program Files\Xinox
Software\JCreator\Templates\
2. Create a new folder Template_N, the N stands for the next
template number.
3. Copy the files setup.tst and Project_Name.java from the
Templates\Template_1 folder to the new folder.
4. Open the file setup.tst with JCreator and select the text
next to the [LABEL] tag.
5. Input the name of your new template (replace the selected
text).
6. Open the file Project_Name.java, and modify the code as
required.
Note: the <PROJECT NAME> tag represents the name of
the project.
7. Insert other Java files as desired in the new template folder.
8. Save the files setup.tst and Project_Name.java.
The new project template now appears in the list of templates
in the Project Wizard.
S e t t i n g t h e Cl a s s Pa t h
The Class Path system variable needs to include the path to any
new libraries that your application uses. Use the following steps
to set the Class Path:
1. Click Project Properties in the Project menu.
2. Select the Required Libraries tab.
3. Click New.
The Set Library dialog box opens up.
4. Click Add.
5. Select the folder that contains the library file.
6. Name the library and click OK.
The Set Library dialog box closes, and the new library
appears in the list of required libraries.
27
D e b u g g i n g Yo u r C o d e
Start the debugger by clicking Start Debugger, in the Build
menu.
JCreator starts up a Java Virtual Machine (JVM), loads the
specified class, and stops the JVM before executing the first
instruction of this class.
You can now step through the execution of the class, and set
break points. You can also examine variables, stack data, and
thread data.
Setting a Breakpoint
The debug JVM stops executing when it encounters a
breakpoint. You can set a breakpoint either before or during
program execution, using the following steps:
1. In the edit window, position the cursor where you want the
debugger to stop.
2. Right click, and select Toggle Breakpoint (or use shortcut
F9).
E x a m i n i n g a C l a s s Va r i a b l e
During debugger execution, you can examine the value of a
class variable, as follows:
1. In the edit window, double-click on the variable of interest.
2. In the Build Menu, point to Debugger, and click Dump, or
use shortcut F8.
The debugger outputs the current value of the variable (in the
Debug Output tab of the Output view), and outputs the value
every time it changes during execution.
Pa c k a g i n g Yo u r A p p l i c a t i o n
JCreator Users Guide
28
GETTING STARTED
Java supports packaging of an application into a single file,
known as a Jar file.
Use JCreator to create a Jar file from all of the Java files in the
active project, as follows:
1. Click Set Active Project in the Project menu.
The menu displays a check mark next to the currently active
project.
2. If necessary, click the desired project in the list, to make it
the active project.
3. Click Create Jar File in the Tools menu.
The General Output tab in the Output view displays a list of
all classes added to the Jar file, and indicates Process
Completed when the command has completed successfully.
29
INDEX
A
arguments, prompting for 14
B
breakpoints 24
C
Class Path 23
code completion 15
command shortcuts 19
Configure menu 17
Customize dialog box 16
JDK 5
download 5
install 6
M
Menu
add command 17
context menu 16
move command 18
O
Options dialog box 13
Output view 9
Edit view 9
editing preferences 15
project
compiling 11
create 22
definition 21
directory 13
execution 11
template 23
Project Wizard 10
Properties view 9
File view 9
System requirements 5
Toolbar
add commands 17
debug commands 23
download, how to 6
J
Jar files 24
Java Class documentation 6
access 22
Java Development Kit See JDK
W
workspace
create 21
definition 21
views 9
32