Skip to content

Instantly share code, notes, and snippets.

@ggdio
Created July 18, 2017 19:21
Show Gist options
  • Save ggdio/c5f8af8a2fcec7aecbf941aeda71a130 to your computer and use it in GitHub Desktop.
Save ggdio/c5f8af8a2fcec7aecbf941aeda71a130 to your computer and use it in GitHub Desktop.
Sample nashorn script that will run on shell
#!/usr/bin/env jjs
// Import JOptionPane from javax.swing
var JOptionPane = Java.type("javax.swing.JOptionPane");
/**
* Nashorn impl.
*/
(function() {
print("Running Nashorn Through Shell");
var name = $ARG[0];
JOptionPane.showMessageDialog(null, name ? "Hello, ${name}!" : "Hello, world!");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment