Created
July 18, 2017 19:21
-
-
Save ggdio/c5f8af8a2fcec7aecbf941aeda71a130 to your computer and use it in GitHub Desktop.
Sample nashorn script that will run on shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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