Last active
January 27, 2021 11:13
-
-
Save karussell/ebdc510d8af054fe0832d93c37b2e8b5 to your computer and use it in GitHub Desktop.
IntelliJ Debugging for Janino
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
class MyTest { | |
@Test | |
public void testX() throws CompileException { | |
IScriptEvaluator se = new ScriptEvaluator(); | |
MyInterface i = (MyInterface) se.createFastEvaluator("" | |
+ "System.out.println(\"Hello\");\n" | |
+ "String s = \"World\";\n" | |
+ "System.out.println(s);\n" | |
+ "return true;", | |
MyInterface.class, new String[0]); | |
// set this to VM options | |
// -Dorg.codehaus.janino.source_debugging.enable=true -Dorg.codehaus.janino.source_debugging.dir=./src/main/java | |
// this does not work as IntelliJ cannot compile it | |
// -Dorg.codehaus.janino.source_debugging.keep=true | |
System.out.println("blup = " + i.goForIt()); | |
} | |
} |
Not sure if that worked for me. What really worked for me in the end is creating the source file in the classpath (to make it available to intellij) and start debugger. See here how I create the source: https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/weighting/custom/CustomModelParser.java#L374
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So you were able to debug like that?