Title: CS1371 Introduction to Computing for Engineers
1CS1371Introduction to Computing for Engineers
- Java Development Environments
2The Java Language
- Writing your first Java program
- Using JCreator
- Using NetBeans
- Using Eclipse
Learning Objectives The old way to program in
java. Understanding the environment in which you
will write Java code
3The Old Way
- Eclipse, JCreator, and NetBeans all provide one
key concept. They provide an environment where
you can edit, compile, and run your Java programs
in one place. Do not take them for granted. - The old-fashioned way is a real pain.
- The old-fashioned way involved typing your
program in a text editor than going over to the
command line to compile and run it. - This is called Command Line Programming.
4Command Line Programming
- First you had to code and edit your program in
the text editor of your choice and remember to
save your file in the form of SomeClass.java. - Then you must go to the command line (hence
Command Line Programming) and set the Path for
your Java Virtual Machine if you have not done so
already. - Then compile your program by typing
- javac SomeClass.java
- If you had errors you must go back to your editor
fix and resave your file, which can be a pain. - Once all errors are gone you will get a file
called SomeClass.class. - Once that happens you can type java
SomeClass.java and observe your output.
5Command Line Programming
First Set the Path
Then Compile your File by typing javac
You then get your class file
Then type java to run and view out put
6General Concepts
- JCreator, Eclipse, and NetBeans use the
following concepts to manage the files for a
project - A Workspace in which multiple projects are stored
- A Project in which multiple files are stored
- Source files with the extension .java containing
human-readable program statements - created by you in an editor
- Class files with the extension .class containing
machine-readable program logic - Created by the Java compiler
7The Java Language
- Using JCreator
- Using NetBeans
- Using Eclipse
8JCreator Implementation
- JCreator permits you to maintain multiple
workspaces, each containing multiple projects - The workspaces have the extension .jcw, and are
found in the root directory where you opened the
workspace. - You may never need more than one per class.
- Projects have the extension .jcp, and are usually
located with the Java files in sub-directories
below the workspace.
9Obtaining JCreator
- JCreator must be installed in two stages
- Obtain the java Software Development Kit (SDK)
from the sun web site - http//java.sun.com/j2se/1.4.2/download.html
- Select the link to Download J2SE SDK and follow
the directions using default answers wherever
possible. - Obtain JCreator itself from
- http//www.jcreator.com/download.htm
- Select the link to Download JCreator LE Version
and follow the directions. - As part of the installation process, JCreator
will search your system for the right Java SDK.
10JCreator your first program
- When JCreator first starts, you see this view
Choose File New Blank Workspace
11JCreator creating a Workspace
Enter the name of the workspace
Browse for its location
Finish
12JCreator creating a Project
Right click on the workspace and select Add new
Project
13JCreator creating a Project
Choose Empty Project
Choose Next
14JCreator creating a Project
Enter the name of the project
JCreator sets default locations for the java and
class files
15JCreator creating a Program
Right click the Project
Select Add New File
Select Java File
Enter the class name
Browse for the location
Finish
Select Next
16JCreator writing a Program
Type the program
Click here to compile the program
When error free, click here to run the program
Any errors will be announced here
17JCreator program output
18Questions?
19The Java Language
- Using JCreator
- Using NetBeans
- Using Eclipse
20NetBeans Implementation
- NetBeans permits only one workspace
- Its default location is hidden somewhere in
youre My Documents folder - Multiple projects in that workspace are
controlled by a Project Manager.
21Obtaining NetBeans
- NetBeans can be installed in one simple
operation - Obtain the integrated Netbeans and java Software
Development Kit (SDK) from the sun web site - http//java.sun.com/j2se/1.4.2/download-netbeans.h
tml - Select the link to Download and follow the
directions using default answers wherever
possible. - As part of the installation process, NetBeans
will connect to the right Java SDK. - Mac OS users will need to separately install
the java SDK and Netbeans similar to the JCreator
procedure.
22NetBeans creating a Project
- When NetBeans first starts, you see this view
Choose Project Project Manager New
Enter the name of the project
23NetBeans accessing files
Right click in Filesystems
Make sure the Filesystems tab is selected
Select Mount Local Directory
24NetBeans creating a Project
Right click on the workspace and select new
Project
25NetBeans creating a Project
Choose Empty Project
Choose Next
26NetBeans creating a Project
Enter the name of the project
Hit Finish
27NetBeans writing a Program
Click here to compile the program
Type the program
When error free, click here to run the program
Any errors will be announced here
28NetBeans program output
29The Java Language
- Using JCreator
- Using NetBeans
- Using Eclipse
30Eclipse
- Eclipse is an advanced IDE with many professional
capabilities. - Eclipse will point out any errors that you will
have while you code which makes error checking
easy. - Eclipse is supported on many different platforms.
- Eclipse will permit only one workspace.
31Eclipse
- Eclipse can be installed easily, but you must
have a SDK installed first because eclipse will
look for it on your computer. - Go to http//www.eclipse.org/downloads.index.php
- Download the latest version(3.0). Try using one
of the mirrors they have listed. If you cannot
get a good connection go to the link that says
main download site and download it from there and
place it somewhere on your computer where you
find it later. - Go to where you saved your download and extract
the files to a location of your choice for
example C\eclipse. Mac users install by copying
the entire folder to /Applications directory. Now
for easy access right click on the eclipse icon
and create a desktop shortcut.
32Eclipse Creating a Workspace
- Creating a workspace is easy.
- Right click on your desktop icon and select
properties. - In the target textfield type C\eclipse\eclipse\e
clipse.exe -data C\workspaces\cs1371 - Hit apply and then ok.
- Your workspace is set up.
33Eclipse New Project
Click here (the new button)
Select Java Project
Hit Next
34Eclipse New Project (Continued)
Enter the Project Name
Hit Finish
35Eclipse Adding Files
Right-click on the project you just created and
select new
Select Class
36Eclipse Adding Files (cont.)
Type the name of the class
Hit Finish
Check public static void main(String args)
37Eclipse Creating a program
Type your code here
Hit the arrow and select run as a Java application
Output will be generated here
If there are any errors they will be generated
on the side, next to the line that caused the
error, indicated by a red X. If you hover over
the X with your mouse it will tell you whats
wrong.
38Summary
- Eclipse, JCreator, and NetBeans provide stable
development environments for Java programming. - Concept of a Workspace (NetBeans has only one)
- Concept of a Project
- Differences in philosophy
- JCreator is all-inclusive by default
- If you create a new project in a directory
containing java files or sub-directories with
java files, it presumes they are all included in
the project - NetBeans Eclipse are exclusive by default
- You must explicitly mount a file system for a
project, and then import java files into the
project - Eclipse and NetBeans provides significantly more
professional support - Javadoc access and autocompletion
- Debugging with break points etc. (available in
paid versions of JCreator)
39Questions?
40(No Transcript)