< prev index next >
src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java
Print this page
*** 47,56 ****
--- 47,58 ----
* Interactive command line Shell for Nashorn.
*/
public final class Main extends Shell {
private Main() {}
+ static final boolean DEBUG = Boolean.getBoolean("nashorn.jjs.debug");
+
// file where history is persisted.
private static final File HIST_FILE = new File(new File(System.getProperty("user.home")), ".jjs.history");
/**
* Main entry point with the default input, output and error streams.
*** 98,108 ****
final ScriptEnvironment env = context.getEnv();
final String prompt = bundle.getString("shell.prompt");
final PrintWriter err = context.getErr();
final Global oldGlobal = Context.getGlobal();
final boolean globalChanged = (oldGlobal != global);
! final Completer completer = new NashornCompleter(context, global, this);
try (final Console in = new Console(System.in, System.out, HIST_FILE, completer)) {
if (globalChanged) {
Context.setGlobal(global);
}
--- 100,111 ----
final ScriptEnvironment env = context.getEnv();
final String prompt = bundle.getString("shell.prompt");
final PrintWriter err = context.getErr();
final Global oldGlobal = Context.getGlobal();
final boolean globalChanged = (oldGlobal != global);
! final PropertiesHelper propsHelper = new PropertiesHelper(env._classpath);
! final Completer completer = new NashornCompleter(context, global, this, propsHelper);
try (final Console in = new Console(System.in, System.out, HIST_FILE, completer)) {
if (globalChanged) {
Context.setGlobal(global);
}
*** 159,168 ****
--- 162,178 ----
}
} finally {
if (globalChanged) {
Context.setGlobal(oldGlobal);
}
+ try {
+ propsHelper.close();
+ } catch (final Exception exp) {
+ if (DEBUG) {
+ exp.printStackTrace();
+ }
+ }
}
return SUCCESS;
}
< prev index next >