Sei sulla pagina 1di 29

Streamline Your

Java Development
With JCreator IDE

JCreator Users Guide


Version 1

Jan 3rd, 2006

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

Downloading the JDK


Download the JDK from the Java web site. From a browser
window, complete the following steps:
1.
2.
3.
4.
5.

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

JCreator Users Guide

The installation file downloads to the location specified in


step 7.

JCreator Users Guide

GETTING STARTED

Installing the JDK


The Installer puts the JDK in a folder named Java in your
Program Files. If you prefer to put the JDK in a different
location, create a directory prior to installation. Complete the
following steps to install the JDK:
1. Double-click on the installation file.
This starts the Setup program.
2. Accept the defaults when prompted (or input your JDK
directory location).

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

JCreator Users Guide

Downloading the JCreator IDE


Software
This section describes how to download JCreator from the Xinox
Systems web site. To get access to the free version of the
software (JCreator LE), you need to register your name and
email id. To maintain the privacy of your main email id, we
recommend that you obtain a secondary email id (available at
no charge from sites such as Yahoo).
Once you have defined your email id, proceed with the
following steps:
1. Navigate to www.Jcreator.com.
2. Click Download in the menu on the left side of the page.
3. Click Download for the JCreator LE product.
This opens a page with a simple web form.
4. Type in your name and email id.
5. Click Submit.
6. Look for an email from JCreator in the inbox associated with
the email id you provided in step 4.
7. Click the download link in the email from JCreator.
The download puts a compressed installation file in the
location that you specify.

Installing the JCreator IDE Software


Installation consists of decompressing and running the
downloaded zip file. You must also provide some basic
configuration information when you launch JCreator for this
first time.
To install the JCreator IDE, complete the following steps:
1. Double-click the downloaded zip folder.
2. Click Extract Files, in the File menu.
This launches a wizard to extract the files.
3. Select the default settings in the wizard.
This creates a new folder (in the same location) containing
the extracted files.
4. Double-click Setup.exe.
This launches the installation wizard, which guides you
through the installation.
When you launch JCreator LE for the first time, you need to
provide some additional configuration information:
JCreator Users Guide

10

GETTING STARTED

The file extensions to associate with JCreator (use the


default set)
The JDK home directory (location defaults to Program
Files\Java\jdk1.5.0_05)
The JCreator Project directory

11

JCreator Users Guide

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

The following diagram shows the locations of the views in the


workspace.

Creating the Project


In JCreator, a project holds a set of source files that you want to
edit and compile at the same time.
JCreator provides a wizard to create a new project. Use the
defaults offered by the wizard. You need to provide a project
name, which has the same name as the starting-point class for
your program. Create a project using the following steps:
1. Click New Project in the Project menu.
The Project Wizard dialog box opens.
2. Click Basic Java Application, and then click Next.
3. Type in the name of the project, and click Finish.
JCreator creates a folder and a Java file with your project name.
You can see the new folder and file in the File view of the IDE.

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");

4. Save the file.

Your workspace now looks like the following screenshot.

Compiling the Class


The Project Wizard sets your project to use the compiler from
the JDK.
To compile your code, complete the following steps:
1. Click Compile Project, from the Build menu.
The Output view displays the compiler version, followed by
the compile results.
2. Review the compile results in the Output view.
For each compile error, the task list tab displays the error
description, file name and line number for each error.
3. Correct your code, and recompile.
The Build Output tab displays Process Completed for a
successful compile.

Executing the Program


You can now execute the compiled program, using the following
steps:
15

JCreator Users Guide

1. Click Execute Project, from the Build menu.


Two new windows open up:
A Windows command window
A Java frame
2. Minimize the Java frame, to make the command window
visible.
The command window displays Hello World if your
program executed properly.
3. Check for error messages if nothing displays.
4. Close the Java frame.
The command window displays Press any key to
continue
5. Press any key (or close the window) to terminate the
program.
By compiling and executing this very simple program, you have
validated the basic setup of the JCreator IDE on your computer.

JCreator Users Guide

16

CUSTOMIZING YOUR WORKSPACE


In this chapter, we show you how to set various options and
configuration parameters in the JCreator workspace to suit your
style of working.

Setting General Preferences


You can change (or verify) a number of general settings via the
Options dialog box. This dialog box contains a menu in the left
frame. The contents in the right side of the box changes
depending on which menu item you select.

Changing the Default Project Directory


JCreator creates project folders in this Windows directory.
Project folders contain all your source code files, so locate your
project directory in a location that gets backed-up frequently.
Use the following steps to set this location:
1. Click Options in the Configure menu.
This opens the Options dialog box.
2. Click Directories in the menu (see the following diagram).
3. Enter your project directory in the Default Project
Directory input box.
4. Click OK.

JCreator Users Guide

18

GETTING STARTED

Prompting for Main Arguments


If your Java program accepts arguments entered in from the
command line, you need to set the IDE to prompt the user for
these values.
1. Click Options in the Configure menu.
This opens the Options dialog box.
2. Click JDK Tools in the menu (see the following diagram).
3. Select the <default> check box.
4. Click Edit.
5. Click the Parameters tab.
6. Select the Prompt for Main Method Arguments check
box.
7. Click OK.

19

JCreator Users Guide

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.

In sertin g B rackets Au tom atically


Set this option as follows, to speed up your code entry:
1. Click Options in the Configure menu.
This opens the Options dialog box.
2. Click Java (under Editor) in the menu (see the following
diagram).
3. Select the Auto Insert Brackets check box.

Setting Auto Code Completion


When typing in new source code, you can activate the code
completion feature using the following steps:

JCreator Users Guide

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).

Changing the Context Menu


When you right click anywhere in the workspace, JCreator
displays the context menu. You can add other commands to this
menu, by following these steps:
1. Click Customize in the Configure menu.
This opens the Customize dialog box.
2. Click the Menu tab.
3. Select Context menu in the box Select context menu.
The context menu opens.
21

JCreator Users Guide

4. In the Customize dialog box, Click Commands.


5. Drag any command from the Commands list onto the desired
location of the Context menu.
This adds the command to the menu.
6. When you have finished adding commands to the Context
menu, close the Customize dialog box (the Context menu
closes automatically).
Test your changes by right clicking. The additional commands
now display in the context menu.

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.

Adding Commands to a Menu


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 the name of the
menu on the menu bar (do not release the mouse button).
JCreator displays the whole menu.
4. Drag the command to the desired location in the menu, and
release the mouse button.
The menu location now contains the command.
5. When you have finished adding commands, close the
Customize dialog box.

JCreator Users Guide

22

GETTING STARTED

Changing Commands in a Menu


1. Click Customize in the Configure menu.
This opens the Customize dialog box.
2. Click the menu that you want to change.
A change box highlights the menu name, and JCreator
displays the whole menu.
3. To move the whole menu, drag the menu to a different
location on the menu bar, and release the mouse button.
4. To change the location of a menu command:
Click the command name.
A change box highlights the command (see the
screenshot below)
Drag the command to a new location on this menu (or to
a location on any other menu).
Release the mouse button.
The chosen menu location now contains the command.
5. When you have finished changing menu commands, close
the Customize dialog box.

23

JCreator Users Guide

Creating and Changing Command


S h o r tc u t s
JCreator assigns a default set of keyboard shortcuts for popular
commands.
You can add (or change) the shortcut for a command, by using
the following steps:
1. Click Customize in the Configure menu.
This opens the Customize dialog box.
2. Click the Keyboard tab.
3. Click All Commands in the Commands scrolling list.
4. Click on the command that you want to give a new (or
changed) shortcut.
5. Click in the Press New Shortcut Key input box (see the
following diagram).
6. Press the key that you chose for this shortcut. If using two
keys, press both keys simultaneously.
The Assigned To text box (below the input box) indicates
unassigned for an available shortcut. For a shortcut
already in use, it displays the associated command name.
7. Repeat steps 4-6 to create additional shortcuts.
8. When you have finished, close the Customize dialog box.

JCreator Users Guide

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

3. Type in the name of the project and click Next.


4. Choose the JDK version for this project (by selecting the
associated check box) and click Next.
5. Choose the compiler for this project, and click Finish.

Accessing JDK Documentation


To access the documentation for a specific base class or
method, use the following steps:
1. Select the name of the class or method in your edit window.
2. Right-click in the selected area.
3. Click Show JDK Help.
The Java Platform documentation opens as an additional
window in your editing view, displaying the documentation
for the class or method that you selected in step 1.
To browse the documentation, use the following steps:
1.
JCreator Users Guide

Click JDK Help, in the Help menu.


26

GETTING STARTED

2.

This opens a documentation window in your editing view.


Click the Tree tab.
This provides a hierarchical view of all the Java base classes,
for ease of browsing.

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

JCreator Users Guide

7. Select the checkbox beside the library name.


The class path now includes the path to this library.

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

JCreator Users Guide

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

installing the JDK 6

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

JCreator Users Guide

32

Potrebbero piacerti anche