Using the Jcreator Integrated Development

Using the Jcreator Integrated Development

<p> Using JCreator</p><p>Using the JCreator Integrated Development Environment (IDE) for Programming in JAVA</p><p>Exercise 1</p><p>By: Professor Thomas G. Re - Nassau Community College</p><p>What is an IDE?</p><p>An IDE (Integrated Development Environment) is an application used to aid a programmer in developing computer applications or programs. This application provides a means for the programmer to quickly; identify keywords and reserve words, “edit, compile and run programs with a click of a button”i. JCreator1 is an example of an IDE that will become a valuable tool for the student to use to complete each of their projects for this course.</p><p>JCreator contains a text editor that highlights the reserved words in the text of a computer program written in the Java programming language. These reserved words are normally highlighted in blue and cannot be used as an identifier2, method name, or class name. </p><p>This IDE also provides a means for a programmer to organize their source code into a project or package. In this way each file that is created can be placed into an easily accessible package. Each file then can be opened simultaneously in one environment. </p><p>Much the same way multiple documents can be opened in a word processing program. </p><p>Each file can then be edited, compiled and then run as one project within this </p><p>1 The version of JCreator used in this exercise is 3.50. It is up to the student to ensure that he/she is using the correct version of the IDE 2 An Identifier is a name given to </p><p>1 environment. This makes editing multiple files in one program much easier than environments that only allow one file to be opened at one time.</p><p>In no means is this environment the “Compiler” for your JAVA programs. </p><p>JCreator uses the JAVAC compiler developed by Sun Microsystems TM to compile the </p><p>Java source code into Java Byte code. It is just an editor that provides an easy to use editor and debugger for creating Java source code. In order to create the JAVA byte code you still need to use the Java Compiler developed by Sun Microsystems TM. You can download the JAVAC compiler from java.sun.com .</p><p>Using JCreator</p><p>To use JCreator the program must first be installed on the computer correctly. If using this program in the computer labs at the college, then this is assumed. Before starting a programming project, the student should finish steps 1 to 3 of the Software development process provided on page 7 in their textbook.</p><p>1. Click on the JCreator icon on the desk top ( IF Dialog boxes appear click</p><p> next and then ok until the IDE environment window appears).</p><p>2. You should then have a window that looks like Figure 1.</p><p>2 Figure 1</p><p>3. Click on File then New then Project(You will have a window that looks like</p><p>Figure 2)</p><p>Figure 2 4. For Every project in this class you must (These steps are modified each time you </p><p> create a new project with names and folders that pertain to each project).</p><p> a. Select an Empty project</p><p> b. Click Next</p><p>3 Figure 3 c. Provide a Location, Source Path, and Output Path. This should be a folder</p><p> in your J:\ drive3. You can change the path for each text box by clicking </p><p> on the button next to each text box illustrated above.</p><p> d. Give the project a Name4 (Here we are using HelloWorld as the project </p><p>Name)</p><p> e. Be sure that Location, Source and Output Path have the same folder as the </p><p> project Name5.</p><p> f. Click Next then Next then Finish </p><p>5. In order to continue you must complete steps 1 through 3 of the Software </p><p>Development Method found in your text bookii.</p><p>6. Create the first file for your Java program.</p><p> a. Click File then New then File (You should have the window shown in</p><p>Figure 4)</p><p>3 Your J:\ drive is space provided for each student on the computer network at school. This only pertains to projects that are done at school. If you do projects at home then select a folder on you C: drive on your local computer. 4 All programs that are written for this course are to be placed in a project and given a unique name 5 This will create a folder in the J:\ drive with the same name as the project.</p><p>4 Figure 4 b. Fill in the name of the file in the Name: text box (With this example we </p><p> use MyProg as the filename).</p><p> c. Click Finish</p><p>7. Type in the source code needed for the main implementation file6 found on page 9</p><p>8. Create the second File</p><p> a. repeat steps in step 6</p><p> b. the name of the file should be Message</p><p>9. Fill in the code for the second file found on page 9 of this document.</p><p>10. Compile each file</p><p> a. Click the tab on the top of the editor field of the file to compile</p><p> b. Click Build and Compile File not project</p><p> c. Read the errors in the Output pane of the IDE</p><p> d. Fix errors and repeat step a.</p><p> e. repeat step a. with the other files in the project</p><p>11. Compile the Project -> Click Build and then Compile Project</p><p>12. Run Project -> Click Build and then Execute Project</p><p>6 A big Note: when typing the source code for your project fill in what you can at the moment (this will change as the program gets larger). For Example type in the keywords that make up the class, attributes of the class, and method headings and curly braces.</p><p>5 When you execute the program you will have a window that looks like that in Figure 5</p><p>Figure 5 Complete this exercise by completing the key word, review questions and the review exercise at the end of this document on page 10</p><p>Note and Reminder</p><p>Although you are not getting a grade for this exercise it is important to finish this exercise to gain a firm understanding of the material discussed in this document. Not completing this exercise will ensure that you WILL NOT be able to finish project one when it is assigned. You may get help from the lab staff and other students with this exercise but not on Project 1. </p><p>You must bring this and ALL exercises to class in order to participate in class discussions.</p><p>6 Hello World This is an example of using the Software Development methodii.</p><p>There are 6 Steps to the Software Development Method. You must complete all of these steps in order to finish developing a programming project. The program problem is :</p><p>Write a program that will output to the user the words Hello World!!!! To standard output.</p><p>1. “Specify the problem requirements”</p><p> a. State the problem clearly and zero in to the problem specifics -> output to </p><p> the user Hello World!!!!!</p><p> b. Understand what is required to solve the problem.</p><p>2. Analysis</p><p> a. Input -> None</p><p> b. Ouput -> Hello World!!! To standard out</p><p> c. Identify additional requirements -> None</p><p> d. Identify the process that transforms the inputs to outputs - > None</p><p> e. Identify the objects for the solution to the problem </p><p>Main implementation class (new class)7</p><p>Message class ( new class )</p><p>3. Design the class</p><p> a. Locate classes in existing libraries or projects -> none for this project</p><p> b. Modify existing classes if necessary -> none for this project</p><p>7 Every program should contain at least two classes. The main implementation class and the worker class or object.</p><p>7 c. Design new classes (list the attributes and methods of each new class. No </p><p> coding should be done at this point).</p><p>MyProg class</p><p>Attributes:</p><p>None</p><p>Methods:</p><p>Main method</p><p>Message class</p><p>Attributes8:</p><p>String -> theMessage</p><p>Methods9:</p><p>Default Constructor -> initialize the string Message to “Hello </p><p>World!!!”</p><p>Print Method -> Prints the string Message to standard out.</p><p> toString Method -> used to print the object HeloWorld from </p><p> outside of the class HelloWorld.</p><p>4. Implement the new classes (Coding can be done at this point and each class </p><p> should be in a separate file) Type the classes into the editor and save each class</p><p>8 Attributes describe an object i.e. colour, name, age etc. Normally contains the data that describes an object 9 Methods provide an action on an object i.e. Set, initialize data or attributes, print attributes, etc.</p><p>8 File 1 (Main Implementation File). public class MyProg10 { public static void main(String[] args) { Message MyMessage = new Message(); MyMessage.printMessage(); } }</p><p>File 2 (Worker File).</p><p> public class Message { private String theMessage; public Message() { theMessage = “Hello World!!!!!!!”; } public void printMessage() { System.out.println(theMessage); } public String toString() { return theMessage; }</p><p>}</p><p>5. Test and verify the complete program. a. Compile each file separately to localize the errors. i. Fix the errors ii. Recompile the file and repeat if necessary. b. Compile the whole project c. Run the project</p><p>10 Class Name must be the same as the file name</p><p>9 Exercise 1 review</p><p>Key Words class attribute method compile source code machine code JAVA byte code constructor standard out standard in</p><p>Review Questions</p><p>1. List three output devices on a computer?</p><p>2. List three input devices on a computer?</p><p>3. What is an IDE?</p><p>4. At minimum, how many files should you have with your JAVA program?</p><p>5. Explain what the main implementation (driver) class does in your JAVA program?</p><p>6. Explain why it is important to compile each file separately?</p><p>Review Exercise</p><p>Write a program like the hello world program entirely on your own. Instead of printing Hello World to the screen, output your name. Be sure to use the steps in the </p><p>Software development process provided on page 7 for this and every project that you do for this course.</p><p>10 Appendix A The JCreator IDE</p><p>Package View Pane</p><p>File View Pane Edit Window</p><p>Output Pane</p><p>11 Appendix B Close up look at the different Panes or windows of the JCreator IDE</p><p>Project View Pane in JCreator Class View Pane in JCreator</p><p>Output Pane with a typical Error</p><p>Output Pane Without an Error</p><p>12 Works Cited</p><p>13 i An Introduction to Computer Science Using Java Samuel N. Kamin, M. Dennis Mickunas, Edward M. Reingold McGraw Hill 2002 page 23 ii Problem Solving with Java Second Edition Eliot B. Koffman, Ursula Wolz Addison Wesley, New York, 2002, page 21</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    14 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us