CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.

Slides:



Advertisements
Similar presentations
Object Oriented Programming in Java George Mason University Fall 2011
Advertisements

1 eclipse Tips. 2 What is eclipse? Eclipse is a popular IDE (Integrated Development Environment) that we will use to create, compile, execute, and test.
CS2200 Software Development Lecture 2: Java Program Development Lecturer: Adrian O’Riordan Course Webpage:
How to Create a Java program CS115 Fall George Koutsogiannakis.
CHAPTER 1 INTRODUCTION GOALS  To understand the activity of programming  To learn about the architecture of computers  To learn about machine code and.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
CS115 HOW TO INSTALL THE JAVA DEVELOPMENT KIT (JDK)
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
01 Introduction1June Introduction CE : Fundamental Programming Techniques.
Using Java without BlueJ
Lab 1 Instructor: Jolanta Soltis.
Writing Methods. Create the method Methods, like functions, do something They contain the code that performs the job Methods have two parts.
Introduction to Java.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
PHY281Introduction to JavaSlide 1 Introduction to Java In this section we will learn how how to use Java and write our first Java Applet:  The Java Development.
CS0007: Introduction to Computer Programming Setting Up Java.
Marlene Galea.  The JDK (Java Development Kit)  An IDE (Integrated Development Environment) ◦ Different IDEs include:  JCreator  NetBeans  BlueJ.
Editing Java programs with the BlueJ IDE. Working environments to develop (= write) programs There are 2 ways to develop (write) computer programs: 1.Using.
IB Computer Science II Paul Bui
Introducing Java.
Parts of a Computer Why Use Binary Numbers? Source Code - Assembly - Machine Code.
CSCI 273: Processing An Introduction. Programming Languages –An abstract "human understandable" language for telling the computer what to do –The abstract.
(C) 2010 Pearson Education, Inc. All rights reserved.  Java programs normally go through five phases  edit  compile  load  verify  execute.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
10/10/2015Assoc. Prof. Stoyan Bonev1 COS240 O-O Languages AUBG, COS dept Lecture 10b Title: Running Programs & IDEs (Java) Reference: COS240 Syllabus.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
Putting Applets into Web Pages.  Two things are involved in the process of putting applets onto web pages ◦ The.class files of the applet ◦ The html.
Java Environment CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
1 Chapter 1 Introduction to Java. 2 History of Java Java Originally for _________________________ devices Then used for creating Web pages with __________________________.
Java ACO101: Introduction to Computer Science. The History of Java Started out as a research project at Sun Microsystems in 1991 Code named “Green” Based.
Java and C# [this is a bonus – it is not a required lesson] ACO101: Introduction to Computer Science.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Programming Concept Chapter I Introduction to Java Programming.
Clement Allen, PhD Florida A&M University SUMMER 2006.
COP 3330 Notes 1/12. Today's topics Downloading Java and Eclipse Hello World Basic control structures Basic I/O Strings.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
CSCI Processing CSCI Introduction to Algorithm Design An Introduction.
3 Major Steps for Creating/Running a Java Program You write the source code for the program and save it as a.java file. You compile the.java program using.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
DOS and the Command Line CS 21a: Introduction to Computing I First Semester,
22-July-2002cse142-13B-Development © 2002 University of Washington1 Development Tools CSE 142, Summer 2002 Computer Programming 1
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Eclipse Project. Installing Visit to download a copy for your home computerhttp:// –Get Release version 3.0 (or.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Java FilesOops - Mistake Java lingoSyntax
introductory lecture on java programming
CHAPTER 1 INTRODUCTION. CHAPTER GOALS To understand the activity of programming To learn about the architecture of computers To learn about machine code.
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
Computer Science I Lab 1 ISMAIL ABUMUHFOUZ | CS 180.
CompSci 230 S Programming Techniques
Introduction to Java Import Scanner class to use in our program
The eclipse IDE IDE = “Integrated Development Environment”
GC101 Introduction to computer and program
Programming without BlueJ Week 12
Java programming lecture one
Introduction to Java Dept. Business Computing University of Winnipeg
How to Run a Java Program
Introduction to Algorithm Design
Java Intro.
CS115 HOW TO INSTALL THE JAVA DEVELOPMENT KIT (JDK)
IB Computer Science II Paul Bui
Review of Previous Lesson
Presentation transcript:

CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles

What we will cover… Basic Java Programming (Review) Creating, Compiling, Executing a Java Program Using an IDE Textpad Eclipse JDK

Creating Compiling, and Executing a Java Program You have to create your own program Make sure it works If it doesn’t compile you will not be able to run it! You can compile and run from a command window!

Compiling and Running a File Write your program Save as.java Type javac filename.java Javac = java compile Compiles to a.class file(s) Run java classname.class Runs this within a JVM (Java Virtual Machine)

The Java Virtual Machine The Java Virtual Machine (JVM) is the runtime environment A virtual computer that runs your environment Runs “around” the CPU Creates a layer between the CPU and the Java Program Java is compiled down to bytecode Not machine language JVM is run between the CPU and the Program Slower than something run directly on the CPU This makes the program portable Different JVM’s for different computers (CPUs)

Programming Style Make sure you do the following: Appropriate Comments Proper Indentation and Spacing Space operators Block Styles Next-line style End of line style

Errors There are three possible errors in java Syntax Errors Problems with spelling Missing characters Runtime Errors Abnormal termination Logic Errors

Using an IDE Use Textpad or Netbeans Eclipse is a very powerful IDE we will cover later Good luck!

Textpad Go to Textpad Download The IDE Officially Shareware (Free to download, should pay)

Textpad (2) Install and then run Textpad will install on your computer.

Compiling and Running Using the Command Line Use a text editor (Whatever you choose) Save the file as.java Open a command window: Click the start button Type in cmd (or look for command window in programs)

Compiling and Running Using the Command Line (2) Use DOS commands to locate your java file Get to the location of your file Type javac filename.java Should be the same name as your class

Compiling and Running Using the Command Line (3) Look at our example: Class name is Hello Filename should be Hello.java When we compile, should result in the class name Hello.class To run the program, we must run the class through the JVM (called “java”) java Hello Note: don’t type in java Hello.class (WRONG)

Compiling and Running Using the Command Line (4) Results:

Compiling and Running Using the Command Line (5) Note: If you just want to use the command javac automatically (without using the path name), you must add the path to the computer path Type in “path” at the command line Gives all folders to look for commands

Compiling and Running Using the Command Line (6) After you install the JDK, add the bin folder to the path To change the system path (Windows), perform these steps: Start the System Control Panel applet (Start - Settings - Control Panel - System). Select the Advanced tab. Click the Environment Variables button. Under System Variables, select Path, then click Edit. Other ways (try Windows version first): After this, you can call javac and java (jvm) directly

Using Eclipse Eclipse is a very powerful IDE that can be used to develop Java programs Very complicated to use at first Complex now, later very convenient Download Install Very large file

Eclipse (2) Creating a new project Instead of creating a new file, you must first create a project Holds all files associated with the program Not as necessary now, effective later File -> New -> Java Project Type demo in the Project Name field Select “Use project folder as root for sources and class files” Puts java and class files in same folder Click Finish

Eclipse (3) Creating a new Class File -> New -> Class Opens New Java Class Wizard Type Welcome Our class name Check option public static void main(String[] args) Click Finish

Eclipse (4) Compiling and Running a Class Right-click the Class in Project Display Select Run -> Java Application In context menu Output is displayed in Console pane