Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/com/sun/tools/javac/Main.java
38899 views
/*1* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.tools.javac;2627import java.io.PrintWriter;2829/**30* The programmatic interface for the Java Programming Language31* compiler, javac.32*/33@jdk.Exported34public class Main {3536/** Main entry point for the launcher.37* Note: This method calls System.exit.38* @param args command line arguments39*/40public static void main(String[] args) throws Exception {41System.exit(compile(args));42}4344/** Programmatic interface to the Java Programming Language45* compiler, javac.46*47* @param args The command line arguments that would normally be48* passed to the javac program as described in the man page.49* @return an integer equivalent to the exit value from invoking50* javac, see the man page for details.51*/52public static int compile(String[] args) {53com.sun.tools.javac.main.Main compiler =54new com.sun.tools.javac.main.Main("javac");55return compiler.compile(args).exitCode;56}57585960/** Programmatic interface to the Java Programming Language61* compiler, javac.62*63* @param args The command line arguments that would normally be64* passed to the javac program as described in the man page.65* @param out PrintWriter to which the compiler's diagnostic66* output is directed.67* @return an integer equivalent to the exit value from invoking68* javac, see the man page for details.69*/70public static int compile(String[] args, PrintWriter out) {71com.sun.tools.javac.main.Main compiler =72new com.sun.tools.javac.main.Main("javac", out);73return compiler.compile(args).exitCode;74}75}767778