C o m m a n d l i n e



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

Tutorial 5: Developing Java applications

WebSphere v5 Administration, Network Deployment Edition

Monitor NetSight Server Health

GridWorld Installation Guide

First Steps User s Guide

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

Deploying a Logi Info Application on WAS

Builder User Guide. Version Visual Rules Suite - Builder. Bosch Software Innovations

CPSC 2800 Linux Hands-on Lab #7 on Linux Utilities. Project 7-1

To reduce or not to reduce, that is the question

MIDlet development with J2ME and MIDP

Java Client Side Application Basics: Decompiling, Recompiling and Signing

Understanding class paths in Java EE projects with Rational Application Developer Version 8.0

Rational Application Developer Performance Tips Introduction

Builder User Guide. Version 5.4. Visual Rules Suite - Builder. Bosch Software Innovations

USEFUL UNIX COMMANDS

SDK Code Examples Version 2.4.2

Introduction to Synoptic

Basic Hadoop Programming Skills

Developing In Eclipse, with ADT

Tool - 1: Health Center

Project 5 Twitter Analyzer Due: Fri :59:59 pm

PMOD Installation on Linux Systems

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

List of FTP commands for the Microsoft command-line FTP client

Third-Party Software Support. Converting from SAS Table Server to a SQL Server Database

How to Write a Simple Makefile

VERSION 9.02 INSTALLATION GUIDE.

1. Installation Instructions - Unix & Linux

An Object Oriented Database for Network Management Data

Project Builder for Java. (Legacy)

Automated Offsite Backup with rdiff-backup

Developing Eclipse Plug-ins* Learning Objectives. Any Eclipse product is composed of plug-ins

Running your first Linux Program

Unix Sampler. PEOPLE whoami id who

Opening a Command Shell

An Oracle White Paper March Integrating the SharePoint 2007 Adapter with WebCenter Spaces ( & )

lug create and edit TeX Local User Group web pages

NetBeans Profiler is an

The Hexadecimal Number System and Memory Addressing

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents

Packaging and Deploying Java Projects in Forte

Hadoop Streaming. Table of contents

Using ORACLE in the CSLab

Server Monitoring. AppDynamics Pro Documentation. Version Page 1

Command Line Interface Specification Linux Mac

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

Hadoop Shell Commands

Hadoop Shell Commands

Oracle Enterprise Manager

Hands-on Exercises with Big Data

Supported platforms & compilers Required software Where to download the packages Geant4 toolkit installation (release 9.6)

Practice Fusion API Client Installation Guide for Windows

Table of Contents. Java CGI HOWTO

Thirty Useful Unix Commands

Mobile Application Development

PERFORMANCE COMPARISON OF COMMON OBJECT REQUEST BROKER ARCHITECTURE(CORBA) VS JAVA MESSAGING SERVICE(JMS) BY TEAM SCALABLE

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

IBM SDK, Java Technology Edition Version 1. IBM JVM messages IBM

Leak Check Version 2.1 for Linux TM

Java Crash Course Part I

Magento Search Extension TECHNICAL DOCUMENTATION

CS506 Web Design and Development Solved Online Quiz No. 01

CPSC2800: Linux Hands-on Lab #3 Explore Linux file system and file security. Project 3-1

One or more DTA-100, DTA-102, DTA-107, DTA-110, DTA-140, DTA-545 and/or DTU- 205 devices installed in the target system.

Prepare the environment Practical Part 1.1

create-virtual-server creates the named virtual server

Copyright 2014, SafeNet, Inc. All rights reserved.

1 How to install CQ5 with an Application Server

Server Setup and Configuration

Quick Tutorial for Portable Batch System (PBS)

Introscope Version 7.1 Installation Guide For SAP

USING HDFS ON DISCOVERY CLUSTER TWO EXAMPLES - test1 and test2

Appendix A Using the Java Compiler

Informatics for Integrating Biology & the Bedside. i2b2 Workbench Developer s Guide. Document Version: 1.0 i2b2 Software Release: 1.3.

System Administration. Backups

CRSP MOVEit Cloud Getting Started Guide

LECTURE-7. Introduction to DOS. Introduction to UNIX/LINUX OS. Introduction to Windows. Topics:

Hadoop Installation MapReduce Examples Jake Karnes

Building Software Systems. Multi-module C Programs. Example Multi-module C Program. Example Multi-module C Program

Deploying Microsoft Operations Manager with the BIG-IP system and icontrol

Home Phone Call Forward Guide

Upgrading Software Images on Catalyst Series Switches/routers

Setting up Hadoop with MongoDB on Windows 7 64-bit

Installing FEAR on Windows, Linux, and Mac Systems

Installing Java (Windows) and Writing your First Program

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

IBM Software Services for Lotus Consulting Education Accelerated Value Program. Log Files IBM Corporation

WS_FTP Professional 12

EMC Documentum Content Management Interoperability Services

Transcription:

m a k e f i l e s Make files are a technique by which disparate software tools may be marshalled to work on the construction of a single software project.

C o m m a n d l i n e Make files work using command line utilities so that it will be necessary to learn how to compile programs using the command line rather than using and IDE such as Eclipse.

C o m p i l i n g SYNOPSIS javac [ options ] [ sourcefiles ] [ @argfiles ] PARAMETERS Arguments may be in any order. options Command line options. sourcefiles One or more source files to be compiled (such as MyClass.java).

D e p e n d e n c i e s i n j a v a c Suppose I type javac Gamma.java and class Gamma uses or extends classes Alpha and Beta Search produces a class file but no source file: javac uses the class file. Search produces a source file but no class file: javac compiles the source file and uses the resulting class file. Search produces both a source file and a class file: javac determines whether the class file is out of date. If the class file is out of date, javac recompiles the source file and uses the updated class file. Otherwise, javac just uses the class file.

D e p e n d e n c i e s n o t c a u g h t Suppose both class Alpha and class Delta were declared in file Delta.java In this case javac will not detect that Delta.java has to be compiled to produce file Alpha.class This is an example of the sort of dependency that Makefiles are useful for.

C o m p i l e r o p t i o n s Options are all preceded by a sign -classpath dirlist Sets the user class path, overriding the user class path in the CLASSPATH environment variable. If neither CLASSPATH or -classpath is specified, the user class path consists of the current directory. -d directory Sets the destination directory for class files. The destination directory must already exist; javac will not create the destination directory. If a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed.

R u n n i n g j a v a p r o g r a m s java [ options ] class [ argument... ] java [ options ] -jar file.jar [ argument... ] PARAMETERS options class file.jar argument Command-line options. Name of the class to be invoked. Name of the jar file to be invoked. Used only with the -jar option. Argument passed to the main function.

p r o g r a m t o r u n By default, the first non-option argument is the name of the class to be invoked. A fully-qualified class name should be used. If the -jar option is specified, the first non-option argument is the name of a JAR archive containing class and resource files for the application, with the startup class indicated by the Main-Class manifest header. Examples java Alpha.class Runs class Alpha in the current directory java uk.ac.gla.dcs.mscit.alpha.class Runs file uk/ac/gla/dcs/mscit/alpha.class relative to the current classpath

O p t i o n s -classpath classpath -cp classpath Specifies a list of directories, JAR archives, and ZIP archives to search for class files. Class path entries are separated by colons (:). Specifying -classpath or -cp overrides any setting of the CLASSPATH environment variable Example java -cp foo.jar:fi.jar:fo.jar:fum.jar beanstalk.jack.class Search for beanstalk/jack.class in the jar files specified

M o r e o p t i o n s -verbose:class Displays information about each class loaded. -verbose:gc Reports on each garbage collection event. -version Displays version information and exit. -showversion Displays version information and continues. -help Displays usage information and exit.

C o n t r o l l i n g V i r t u a l M e m o r y s p a c e -Xmxn Examples: Specifies the maximum size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 2 MB. Append the letter k or K to indicate kilobytes or the letter m or M to indicate megabytes. The default value is 64MB. -Xmx83886080 -Xmx81920k -Xmx80m On Linux platforms, the upper limit is approximately 2000m minus overhead amounts. On windows 1000m - overhead.

u s i n g j a r Create jar file jar c[v0m]f jarfile [ -C dir ] inputfiles [ -Joption ] jar c[v0]mf manifest jarfile [ -C dir ] inputfiles [ -Joption ] Extract jar file jar x[v]f jarfile [ inputfiles ] [ -Joption ]

m a n i f e s t Pre-existing manifest file whose name: value pairs are to be included in MANIFEST.MF in the jar file. The m option and filename manifest are a pair -- if either is present, they must both appear. The letters m and f must appear in the same order that manifest and jarfile appear. Example of a manifest file $ cat *.mf Manifest-Version: 1.0 Main-Class: ilcg.pascal.pascalcompiler

u s i n g m a k e to use make simply type make on the command line. make then looks for a file called makefile which tells it what to do

d e p e n d e n c i e s The following is the generic target entry form: # comment # (note: the <tab> in the command line is necessary for make to work) target: dependency1 dependency2... <tab> command

E x a m p l e # # target entry to build program executable from program and mylib # object files using the gcc compiler # program: program.o mylib.o gcc -o program program.o mylib.o

E x a m p l e m a k e f i l e # define a makefile variable for the java compiler JCC = javac # typing 'make' will invoke the first target entry in the makefile # (the default one in this case) default: Average.class Convert.class Volume.class Convert.class: Convert.java $(JCC) $(JFLAGS) Convert.java Volume.class: Volume.java $(JCC) $(JFLAGS) Volume.java # To start over from scratch, type 'make clean'. # Removes all.class files, so that the next make rebuilds them clean: rm *.class

a n o t h e r d e p e n d e n c y # this target entry builds the Average class # the Average.class file is dependent on the Average.java file # and the rule associated with this entry gives the command to create it # Average.class: Average.java $(JCC) $(JFLAGS) Average.java

t y p e d e p e n d e n c i e s There exist systematic dependencies for example.class files are always produced from.java files.o files are usually produced from.c files You can tell make about systematic dependencies

d e p e n d e n c i e s b e t w e e n f i l e t y p e s JC = javac.suffixes:.java.class.java.class: $(JC) $*.java CLASSES = \ Foo.class \ Blah.class \ Library.class Main.class: Main.java $(CLASSES)