INNER CODE UNIT · Java
main
jolie/jolie · jolie-cli/src/main/java/jolie/Jolie.java:68
public static void main( String[] args ) {
int exitCode = 0;
// TODO: remove this hack by extracting CommandLineParser here
boolean printStackTraces = Arrays.asList( args ).contains( "--stackTraces" );
try( CommandLineParser commandLineParser =
new CommandLineParser( args, Jolie.class.getClassLoader(), false ) ) {
Interpreter.Configuration config = commandLineParser.getInterpreterConfiguration();
Optional< Value > params = Optional.of( Value.create() );
if( config.parametersPath().isPresent() ) {
Path paramsPath = config.parametersPath().get();
try( Reader fileReader = Files.newBufferedReader( paramsPath ) ) {
JsUtils.parseJsonIntoValue( fileReader, params.get(), true );
}
}
final Interpreter interpreter = new Interpreter( config, params, Optional.empty() );
Thread.currentThread().setContextClassLoader( interpreter.getClassLoader() );
Runtime.getRuntime().addShutdownHook( new Thread( () -> interpreter.exit( TERMINATION_TIMEOUT ) ) );