Open lae0901 opened 7 years ago
on this issue, electron has nothing to do with it. I call from a node.js script and have the same problem. The call to static main method of the ANTLR Tool class runs. Writes to stdout. But then the node script abruptly ends. How to troubleshoot?
to demo, I added code to the example.js script in examples/lucene. The new code just pushes the antlr-4.7-complete.jar on the classpath list. And then uses callStaticMethodSync to call the main method of the Tool class. No errors. But execution ends without a trace.
Here is the part of example.js that I modified:
var java = require("../../"); java.classpath.push("lucene-core-6.0.0.jar"); java.classpath.push("lucene-analyzers-common-6.0.0.jar"); java.classpath.push("lucene-queryparser-6.0.0.jar");
java.classpath.push("antlr-4.7-complete.jar");
var idx = java.newInstanceSync("org.apache.lucene.store.RAMDirectory"); var analyzer = java.newInstanceSync("org.apache.lucene.analysis.standard.StandardAnalyzer"); var writerConfig = java.newInstanceSync("org.apache.lucene.index.IndexWriterConfig", analyzer); var writer = java.newInstanceSync("org.apache.lucene.index.IndexWriter", idx, writerConfig); var queryParser = java.newInstanceSync("org.apache.lucene.queryparser.analyzing.AnalyzingQueryParser", "content", analyzer);
// call main method of org.antlr.v4.Tool class
var argsArray = java.newArray("java.lang.String", []);
java.callStaticMethodSync("org.antlr.v4.Tool", "main", argsArray);
writer.addDocumentSync(createDocument("Theodore Roosevelt", "It behooves every man to remember that the work of the " + "critic, is of altogether secondary importance, and that, " + "in the end, progress is accomplished by the man who does " + "things."));
Would like to run the Antlr4 parser generator from a node.js package. Prefereably from an electron app.
Using node-java to call the static main method of the Java Antlr Tool class.
I can call the static method. And it produces stdout output.
But after that, the node code fails. No exception messages. The code returns to the command prompt.
To demo the error I modified the example.js file located in the examples/lucene folder.
first, copy the antlr-4.7-complete.jar to the directory of the example.js file.
in the code of example.js push the antlr-4.7-complete.jar:
java.classpath.push("antlr-4.7-complete.jar");
and added a call to the static method of the org.antlr.v4.Tool class:
var argsArray = java.newArray("java.lang.String", []);
java.callStaticMethodSync("org.antlr.v4.Tool", "main", argsArray);
When I run the code execution ends after the "callStaticMethodSync". No exceptions, no messages.
What would cause the process to crash like this?
thanks,