Appendix A Using the Java Compiler



Similar documents
How to Install Java onto your system

Java Software Development Kit (JDK 5.0 Update 14) Installation Step by Step Instructions

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

Right now, the latest and greatest version of Java available for download is Start with this link to find out more about it

Supplement I.C. Creating, Compiling and Running Java Programs from the Command Window

Supplement I.B: Installing and Configuring JDK 1.6

Supplement I.B: Installing and Configuring JDK 1.6

Installing Java. Table of contents

How to use the Eclipse IDE for Java Application Development

Creating a Java application using Perfect Developer and the Java Develo...

Installing Java (Windows) and Writing your First Program

Java with Eclipse: Setup & Getting Started

Java Language Tools COPYRIGHTED MATERIAL. Part 1. In this part...

GridWorld Installation Guide

Practice Fusion API Client Installation Guide for Windows

For Introduction to Java Programming, 5E By Y. Daniel Liang

Microsoft Visual Studio 2010 Instructions For C Programs

Opening a Command Shell

Installing the Android SDK

Installing (1.8.7) 9/2/ Installing jgrasp

Mapping ITS s File Server Folder to Mosaic Windows to Publish a Website

Installing Eclipse C++ for Windows

Manual For Using the NetBeans IDE

Autograph 3.3 Network Installation

Creating Your Own TinyWeb Database. Ball State University - CS116 - Ashley Swartz

Install Java Development Kit (JDK) 1.8

Help File. Version February, MetaDigger for PC

A Java Crib Sheet. First: Find the Command Line

Changing Your Cameleon Server IP

MOODLE Installation on Windows Platform

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3

Installing C++ compiler for CSc212 Data Structures

A Short Introduction to Writing Java Code. Zoltán Majó

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Eclipse installation, configuration and operation

How To Configure CU*BASE Encryption

TSM for Windows Installation Instructions: Download the latest TSM Client Using the following link:

Using Karel with Eclipse

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

About Java Plug-ins. Installing or Uninstalling the Java Plug-in CHAPTER

Installing S500 Power Monitor Software and LabVIEW Run-time Engine

JAVS Scheduled Publishing. Installation/Configuration... 4 Manual Operation... 6 Automating Scheduled Publishing... 7 Windows XP... 7 Windows 7...

Android Environment SDK

LAB4 Making Classes and Objects

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4

Browser-based Support Console

Installation...2 Installation of Athena Visual Studio...2 Authorization...3 Authorization for Corporate License Users...3 Authorization for

Upgrading Your Web Server from ClientBase Browser Version 2.0 or Above to Version 2.1.1

Setting up Sudoku example on Android Studio

SARANGSoft WinBackup Business v2.5 Client Installation Guide

Java Programming Unit 1. Your first Java Program Eclipse IDE

ContentWatch Auto Deployment Tool

WA Continuous Integration with Jenkins- CI, Maven and Nexus. Classroom Setup Guide. Web Age Solutions Inc. Web Age Solutions Inc.

SmartLock Pro Plus Audit View OPERATOR GUIDE

5.6.2 Optional Lab: Restore Points in Windows Vista

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

Titanium Mobile: How-To

HIC.SOAP Network User Instructions last updated June 22, :39 AM

HOW TO SILENTLY INSTALL CLOUD LINK REMOTELY WITHOUT SUPERVISION

HAHTsite IDE and IP Installation Guide

Primavera P6 Professional Windows 8 Installation Instructions. Primavera P6. Installation Instructions. For Windows 8 Users

1.1 Installing Protégé You can follow the steps below to download and install Protégé from the source.

Configuring ICVMLT32.EXE as a Windows Service

CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution

How to Create an Android Application using Eclipse on Windows 7

TIBCO Hawk SNMP Adapter Installation

1001ICT Introduction To Programming Lecture Notes

Bulk Downloader. Call Recording: Bulk Downloader

Android Environment SDK

Using Internet or Windows Explorer to Upload Your Site

SAS 9.3 Foundation for Microsoft Windows

Librarian. Integrating Secure Workflow and Revision Control into Your Production Environment WHITE PAPER

You must have at least Editor access to your own mail database to run archiving.

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Deployment of Keepit for Windows

EMC Documentum Composer

Demo: Controlling.NET Windows Forms from a Java Application. Version 7.3

Setting up Auto Import/Export for Version 7

How to use the VMware Workstation / Player to create an ISaGRAF (Ver. 3.55) development environment?

CS170 Lab 11 Abstract Data Types & Objects

Configuring the BBj Jetty Web Server (rev10.02) for OSAS

Application Notes for Packaging and Deploying Avaya Communications Process Manager Sample SDK Web Application on a JBoss Application Server Issue 1.

Python for Series 60 Platform

Nobeltec TZ: Microsoft SQL Server problems

Olathe District Schools 1 of 11 GroupWise 7

Aspera Connect User Guide

ACTIVE DIRECTORY DEPLOYMENT

Java CPD (I) Frans Coenen Department of Computer Science

How To Encrypt A Traveltrax Report On Gpg On A Pc Or Mac Or Mac (For A Free Download) On A Thumbdrive Or Ipad Or Ipa (For Free) On Pc Or Ipo (For An Ipo)

In this lab you will explore the Windows XP Firewall and configure some advanced settings.

How to Configure Windows 8.1 to run ereports on IE11

Scheduling Automated Outlet Control Using FineSNMPSet with Sentry Switched Power Distribution Units

Wavecrest Certificate

webkpi SaaS ETL Connector Installation & Configuration Guide

RHEV 2.2: REST API INSTALLATION

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

Recommended File System Ownership and Privileges

Microsoft SharePoint 2010 End User Quick Reference Card

Transcription:

Appendix A Using the Java Compiler 1. Download the Java Development Kit from Sun: a. Go to http://java.sun.com/j2se/1.4.2/download.html b. Download J2SE v1.4.2 (click the SDK column) 2. Install Java. Simply follow the prompts. Java will be installed in a folder called jdk.1.4.2 (or possibly sdk1.4.2 or some variation of that) on your c: drive. Make sure you know the name of the directory where Java has been installed. 3. You should set the PATH variable in your system. Setting the PATH variable is not necessary but doing so will allow you to invoke the java compiler from any directory without using the entire pathname. Thus, you will be able to call the java compiler with the simple command javac rather than c:/jdk1.4.2/bin/javac (Actually, Textpad makes it even easier) In Windows 2000 or XP Go to the Start Menu Choose Settings -->Control Panel -->System Choose the Advanced tab and Environmental variables 286

Find PATH in the user variables and the system variables (See below if no PATH variable exits) For each of these PATH variables, click on Edit and then add ;c:\jdk1.4.2\bin to the end of current path variable (note the semi-colon) Click OK and close the windows If no PATH variable exists. Click New instead of Edit and add the new PATH variable. Do this with both the user and system variables. 287

In Windows 95/98: Go to the Start menu Select Run and enter sysedit Open autoexec.bat Look for the path statement (assuming java was installed in jdk1.4.2) If you have no path statement add the line: set path= c:\jdk1.4.2\bin If you have a path statement then add ; c:\jdk1.4.2\bin to the end of the statement. The CLASSPATH You will need to know a little Java before you understand the role of the CLASSPATH. Nonetheless, setting the CLASSPATH will also make compiling a little more convenient. 1. Assume that all of your Java programs will be kept in a root folder called c:\ JavaP (or whatever name you choose). Before setting the CLASSPATH create this folder. 2. Now follow the same instructions as with the PATH variable using CLASSPATH instead of PATH and.;c:\javap instead of c:\jdk1.4.2\bin. Notice that the class path begins with a period. Reboot your computer for the changes to take effect. Textpad We will be using Textpad to create, edit and run programs. You can download a trial version of Textpad at www.textpad.com After installing textpad, you can configure it so that whenever Textpad starts up the startup directory is c:\javap (or wherever you keep your Java programs). To do this Open Textpad and from the menu bar choose Configure -->Preferences-->Folders Under File type click on Startup and enter c:\javap in the textbox: 288

Click OK The installation procedure for Textpad works pretty well. However, you can check that Textpad has been properly installed as follows: Open Textpad and from the menu bar choose Configure -->Preferences-->Tools Expand Tools (click on +) and select Compile Java Make sure that the Command, Parameters and Initial Folder boxes are filled in as in the figure below (Command may contain the full path name, that is OK): 289

Now choose Run Java Application and make sure the Command, Parameters, and Initial Folder boxes are filled in as below: Compiling and running a Java program. 1. Open Textpad ( if you do not see a white editing screen choose file-->new) 2. Enter the following program: public class Test { public static void main(string args[]) { System.out.println( Hello, World ); } } 3. Save your file as Test.java (The file MUST have this name). To do this Choose File-->Save as\ Navigate to c:\javap ( or wherever you want to save the file) Make sure you have chosen Save as type : Java ( see below) Type the filename without an extension (Textpad will add.java) 290

Click Save To Compile the program: 1. Make sure Test.java is still open in the edit window. 2. From the menu bar choose Tools --> Compile Java. If you made any syntax errors, Java will tell you what and where they are. To view you program with line numbers, from the menu bar choose view--> line numbers. To run the program From the menu bar choose Run Java Application. You should see 291

Using Notepad instead of Textpad Java and Object Oriented Programming You can also use Notepad and run you programs from a DOS window. Oddly enough, some programmers prefer this method. To use Notepad ( or any text editor): 1. Write your program in Notepad and save your program with a.java extension, e.g., Test.java. Save the program in the directory c:\javap To prevent Notepad from adding a txt extension place the name of your file in quotes e.g., Text.java 2. Minimize Notepad and open a DOS Window. Navigate to c:\javap. 3. Compile the program with javac Test.java Notice that you need to type only javac and not the entire pathname. This is because we set the PATH variable. Otherwise, to invoke the compiler, you would enter the comand: c:\jdk1.4.2\bin\javac Test.java 4. If there are syntax errors, return to Notepad and fix them. 5. If there are no syntax errors, a file Test.class should appear in your directory c:\javap. This is the executable file. To run the program type java Test Notice there is no extension on the filename (Test). 292