Skip to main content

Compiling and Running Java Programs

  • Chapter
  • First Online:
Foundational Java

Part of the book series: Texts in Computer Science ((TCS))

  • 3093 Accesses

Abstract

This chapter outlines the basics of using the tools provided with Java to compile and run code. It describes how the source code of Java class is structured, how it can be compiled using the “javac” compiler (provided with Oracle’s Java Development Kit or the OpenJDK) and how it can be run on the Java Virtual Machine from the command prompt / terminal. It explains how Java code is put into packages, and how these packages relate to the Java classpath, which it is necessary to set for the Java runtime to locate compiled code. The chapter also describes how the same process of editing, compiling, and running code can be done much more easily using the Eclipse Integrated Development Environment (IDE), which also provides many other useful facilities such as assisting with automatic code generation and highlighting errors. It also shows how Eclipse can automatically put classes into Java modules that may contain multiple packages.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 49.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 64.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 89.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to David Parsons .

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Parsons, D. (2020). Compiling and Running Java Programs. In: Foundational Java. Texts in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-030-54518-5_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-54518-5_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-54517-8

  • Online ISBN: 978-3-030-54518-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics