Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Created April 19, 2017 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frsyuki/496988df4d4085901106e3409b6ffae1 to your computer and use it in GitHub Desktop.
Save frsyuki/496988df4d4085901106e3409b6ffae1 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
import javax.script.*;
public class ScriptTest {
private static volatile boolean stop = false;
public static void main(String[] args) {
Thread t = new Thread(() -> runLoop());
t.start();
Scanner scan = new Scanner(System.in);
scan.nextLine();
stop = true;
}
public static void runLoop()
{
ScriptEngineManager factory = new ScriptEngineManager();
while (!stop) {
ScriptEngine engine = factory.getEngineByName("nashorn");
try {
engine.eval("'text1' + 'text2'"); // removing this line doesn't cause the issue
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment