Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Environment CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.

Similar presentations


Presentation on theme: "Java Environment CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L."— Presentation transcript:

1 Java Environment CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L

2 Outline USC CSCI 201L2/23 ▪J▪Java Environment ▪E▪Eclipse Tutorial ▪P▪Program

3 History of Java ▪Java was created by Sun Microsystems ›First version 1.0 was released in 1996 ▪Sun Microsystems was bought by Oracle in 2010 ▪Java has gone through numerous major and minor releases ›Current major version is Java 8, released in 2013 with few updates since ▪Java is open source ▪http://java.sun.com USC CSCI 201L3/23 Java Environment

4 Compiling ▪Java has a motto of “write once, run anywhere” ›When code is compiled, it produces byte code instead of a binary executable ›The Java Virtual Machine (JVM) is compiled for a specific operating system, then allowing for the byte code to run on any operating system (for which there is a JVM) ›Since the JVM is written in a native language, there may be subtle, or not-so-subtle, differences when run on different JVMs ▪Java may run slightly slower than compiled native languages USC CSCI 201L4/23 Java Environment

5 Command Line ▪You can write with any text editor you want and compile it from a command line that has the Java Development Kit (JDK) installed USC CSCI 201L5/23 Java Environment

6 IDE ▪There are many Integrated Development Environments to use ›Eclipse ›NetBeans ›IntelliJ ›Visual J++ ›Others? USC CSCI 201L6/23 Java Environment

7 Outline USC CSCI 201L7/23 ▪J▪Java Environment ▪E▪Eclipse Tutorial

8 Downloading Eclipse ▪Go to http://www.eclipse.org USC CSCI 201L8/23 Eclipse Tutorial

9 Downloading Eclipse ▪Click Downloads USC CSCI 201L9/23 Eclipse Tutorial

10 Downloading Eclipse ▪Select your OS (if not already selected) then click the version for the Eclipse IDE for Java Developers USC CSCI 201L10/23 Eclipse Tutorial

11 Downloading Eclipse ▪Click the green arrow next to the selected mirror USC CSCI 201L11/23 Eclipse Tutorial

12 Downloading Eclipse ▪Save the zip file USC CSCI 201L12/23 Eclipse Tutorial

13 Downloading Eclipse ▪Open the zip file and drag the “eclipse” directory to your Desktop (or another directory of your choosing) USC CSCI 201L13/23 Eclipse Tutorial

14 Running Eclipse ▪After the zip file finishes extracting, open the “eclipse” directory and run the eclipse executable USC CSCI 201L14/23 Eclipse Tutorial

15 Running Eclipse ▪Select a workspace directory ›The workspace directory will be the one that contains all of your projects, code, and compiled files USC CSCI 201L15/23 Eclipse Tutorial

16 Creating a Project ▪Go to File->New->Java Project USC CSCI 201L16/23 Eclipse Tutorial

17 Create a Project ▪Type a name for the Project and click Finish ›This has nothing to do with the code, but it should be descriptive enough for you to know what code is in the project USC CSCI 201L17/23 Eclipse Tutorial

18 Create a Class ▪Expand the Project by clicking the arrow next to the name of the project you just created USC CSCI 201L18/23 Eclipse Tutorial

19 Create a Class ▪Right-click on “src” and go to New->Class USC CSCI 201L19/23 Eclipse Tutorial

20 Create a Class ▪Type a name for the class and uncheck all other boxes (unless you want Eclipse to generate code for you, which is always dangerous), then click Finish USC CSCI 201L20/23 Eclipse Tutorial

21 Write Some Code ▪You should now have a nearly-blank file and can begin writing code USC CSCI 201L21/23 Eclipse Tutorial

22 Write Some Code ▪Type the following code into the HelloCSCI201.java file USC CSCI 201L22/23 Eclipse Tutorial

23 Running the Code ▪Click the green play button at the top to run your code ›If your code doesn’t compile, you will have error messages at the bottom of the screen ›If your code compiles, your output will be at the bottom of the screen USC CSCI 201L23/23 Eclipse Tutorial


Download ppt "Java Environment CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L."

Similar presentations


Ads by Google