COS 212 Resources

COS 212 Resources

  • Docs

›Java Crash Course

Getting Started

  • Introduction
  • Installing Linux
  • Development Environment

Java Crash Course

  • Hello World
  • Compiling and Running
  • Makefile
  • Comments
  • Variables and Types
  • Operators
  • Slides

Tools

  • Version Control
  • Hello World with Git

Notes

  • Self Organising Lists

Makefile

Below is a simple Makefile that will compile all .java files in the current directory and execute the Main class. Due to its flexibility (no need to define which classes to compile), it is not efficient - it will recompile everything on each run. You can of course optimise the the Makefile to suit your needs.

EDIT (2019-02-12): The Makefile should be indented with TABs not spaces. Do not copy and paste straight from this webpage since it contains spaces. Download the makefile instead

EDIT (2019-02-27): Now compiles and runs in the same rule to avoid Fitchfork errors

run:
    javac *.java
    java Main

clean:
    rm *.class

Download makefile

Usage

Compile and Run:

make run
Last updated on 2/27/2019 by Evert Geldenhuys
← Compiling and RunningComments →
COS 212 Resources
Docs
Getting Started
GitHubStar
Facebook Open Source
Copyright © 2019 Evert Geldenhuys