< prev index next >
src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java
Print this page
@@ -47,10 +47,12 @@
* 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,11 +100,12 @@
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);
+ 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,10 +162,17 @@
}
} finally {
if (globalChanged) {
Context.setGlobal(oldGlobal);
}
+ try {
+ propsHelper.close();
+ } catch (final Exception exp) {
+ if (DEBUG) {
+ exp.printStackTrace();
+ }
+ }
}
return SUCCESS;
}
< prev index next >