Skip to Content
Core Java, Volume II: Advanced Features, 13th Edition
book

Core Java, Volume II: Advanced Features, 13th Edition

by Cay S. Horstmann
August 2024
Intermediate to advanced content levelIntermediate to advanced
988 pages
24h 37m
English
Pearson
Content preview from Core Java, Volume II: Advanced Features, 13th Edition

Chapter 8 ▪ Compiling and Scripting

This chapter introduces two techniques for processing code. You can use the compiler API when you want to compile Java code inside your application. The scripting API lets you invoke code in a scripting language such as JavaScript or Groovy.

8.1. The Compiler API

There are quite a few tools that need to compile Java code. Obviously, development environments and programs that teach Java programming are among them, as well as testing and build automation tools. Another example is the processing of Jakarta Server Pages—web pages with embedded Java statements.

8.1.1. Invoking the Compiler

It is very easy to invoke the compiler. Here is a sample call:

JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Core Java, Volume I: Fundamentals, 13th Edition

Core Java, Volume I: Fundamentals, 13th Edition

Cay S. Horstmann

Publisher Resources

ISBN: 9780135371671