Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Principles of Computer Science II

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

CSC 1302

                                                 Principles of Computer Science II


 JDK, JRE, JVM overview

 JAVA environment Setup


 (Windows, Mac)

 Eclipse Installation

Overview
 Sample Program and Submission

 Lab Instructors & Graders

 Instructions/Guidelines for Lab

 Useful Links
JDK, JRE, JVM

 JVM (Java Virtual Machine) : 


 Abstract computing Machine.
• Platform independent coding.
 JRE (Java Runtime environment) : 
 Implementation of JVM.
• Class Libraries 
• Supporting Files
 JDK (Java Development Kit) : 
 Java applications & applet development
• JRE & Java libraries
• Java Source compilers & debuggers
• Bundling & deployment tools
 Install Java 1.8 JDK from Oracle website to
compile your code

Java
Environment
Setup
 Click the "Download" button for the JDK.

 Agree to the license and download the file for your operating system.

 Run the install file and follow the prompts to install Java.
Windows Setup

 Windows 8/8.1/10: Search for Environment variables in Windows Menu. Select


"Edit the system environment variables".
  Windows 7 and earlier: Search the control panel.
 Navigate to the "Advanced" tab, click "Environment Variables...".
Windows Setup Contd..

 Under "System variables", select "Path" ⇒ Click "Edit...".

 In "Variable value" field, add "c:\Program Files\Java\jdk1.8.0_xx\bin" (location


where JAVA JDK is installed)
  
 Add this location to the beginning of the value of PATH variable

 Click Ok to save your changes.


Windows Setup: Verify JDK installation

 Click "Search" button ⇒ Enter "cmd".


 Issue "path" command and Check <JAVA_HOME>\bin is listed.

 java –version  and javac –version commands to verify JDK/JRE installed


properly.
Windows Setup: Compile & Run Sample JAVA program

 Use programming text editor (TextPad, NotePad++) , enter below source code 
public class Hello { 
      public static void main(String[] args) {
      System.out.println("Hello, world!");
   }
}
 Save file as Hello.java, under your work directory (e.g., d:\myProject).
 Click "Start" ⇒ "run..." ⇒ Enter "cmd". 
                           (Change to Drive where source file is saved)
                             
                                  (Set current  working directory)
                                                                        
                                 

                                  (Run the program)


 
Mac Setup

 To verify your installation, Open a Terminal (Finder -> Go -> Utilities -> Terminal)
 Issue below commands

 Use Text editor (Sublime Text, jEdit), enter "Hello World" program code 
 Save as "Hello.java" under the directory "~/myProject"  
   (Finder -> Go -> Home. Select File -> New Folder -> myProject)
Mac Setup: Compile & Run Sample JAVA program

 Open a new "Terminal" (Go -> Utilities -> Terminal ) and issue below commands.
Eclipse

 An integrated development Environment

  Free software / open source platform-independent


    software framework

Java program development


Editor
Debugger
Source Control 

 Download latest version of eclipse


  http://www.eclipse.org/downloads/packages/release/Oxygen/R

 Unpack the download and run eclipse.exe


Setting up Workspace
  A directory used  to store your projects / programs.
 Click Browse and select the folder MyWorkspace from your directory

 Click OK.  Eclipse SDK window with a Package Explorer tab will be seen
Setting up Workspace Contd..

 Choose a perspective (the layout of Eclipse user interface).

 Open Java perspective ( an interface for editing java source code): click Open


Perspective button > click Java.

 Debug Perspective (an interface for debugging the program).


Sample Problem and Submission
(will not be graded)

 Q. Write a java program named SumThousand. The program add all the integers from 1 to
1000 together and print out the sum. (Note: this problem has been discussed in Monday’s
class).
 

 After finishing the program, submit to iCollege.


Sample Java Program Contd...
 JDK installation for Microsoft Windows:​
http://docs.oracle.com/javase/7/docs/webnotes/install/wi
ndows/jdk-installation-windows.html

Useful Links
 JDK installation for Mac OS X:​
http://docs.oracle.com/javase/7/docs/webnotes/install/m
ac/mac-jdk.html

 JDK installation for Linux Platforms:​


http://docs.oracle.com/javase/7/docs/webnotes/install/lin
ux/linux-jdk.html

You might also like