ServerMain.java revision 2958:27da0c3ac83a
11592Srgrimes/* 215645Sjoerg * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 315645Sjoerg * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41592Srgrimes * 51592Srgrimes * This code is free software; you can redistribute it and/or modify it 61592Srgrimes * under the terms of the GNU General Public License version 2 only, as 71592Srgrimes * published by the Free Software Foundation. Oracle designates this 81592Srgrimes * particular file as subject to the "Classpath" exception as provided 91592Srgrimes * by Oracle in the LICENSE file that accompanied this code. 101592Srgrimes * 111592Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT 121592Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13262435Sbrueffer * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141592Srgrimes * version 2 for more details (a copy is included in the LICENSE file that 151592Srgrimes * accompanied this code). 161592Srgrimes * 171592Srgrimes * You should have received a copy of the GNU General Public License version 181592Srgrimes * 2 along with this work; if not, write to the Free Software Foundation, 191592Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 201592Srgrimes * 211592Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 221592Srgrimes * or visit www.oracle.com if you need additional information or have any 231592Srgrimes * questions. 241592Srgrimes */ 251592Srgrimes 261592Srgrimespackage com.sun.tools.sjavac.server; 271592Srgrimes 281592Srgrimesimport java.io.IOException; 291592Srgrimes 301592Srgrimesimport com.sun.tools.sjavac.Log; 3131331Scharnier 3215645Sjoerg/** 3315645Sjoerg * <p><b>This is NOT part of any supported API. 341592Srgrimes * If you write code that depends on this, you do so at your own risk. 351592Srgrimes * This code and its internal interfaces are subject to change or 361592Srgrimes * deletion without notice.</b> 3731331Scharnier */ 3831331Scharnierpublic class ServerMain { 3931331Scharnier public static int run(String[] args) { 401592Srgrimes 41216582Scharnier Log.initializeLog(System.out, System.err); 42216582Scharnier 431592Srgrimes // Any options other than --startserver? 441592Srgrimes if (args.length > 1) { 4515645Sjoerg System.err.println("When spawning a background server, only a single --startserver argument is allowed."); 4691216Sbde return 1; 4715645Sjoerg } 4891216Sbde 4915645Sjoerg int exitCode; 5015645Sjoerg try { 5166907Swollman SjavacServer server = new SjavacServer(args[0], System.err); 5231331Scharnier exitCode = server.startServer(); 5315645Sjoerg } catch (IOException | InterruptedException ex) { 542286Sjkh ex.printStackTrace(); 5531331Scharnier exitCode = -1; 5615645Sjoerg } 572286Sjkh 5815645Sjoerg return exitCode; 5915645Sjoerg } 6015645Sjoerg} 612286Sjkh