graalpython-java-example
graalpython-java-example copied to clipboard
jar package is not runnable
% mvn package
% java -jar target/PygalExample-1.0-SNAPSHOT.jar
no main manifest attribute, in target/PygalExample-1.0-SNAPSHOT.jar
that is fixed with PR #5 ,
however there is next issue ModuleNotFoundError: No module named 'pygal'
% java -jar target/PygalExample-1.0-SNAPSHOT.jar
Exception in thread "main" ModuleNotFoundError: No module named 'pygal'
at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:353)
at com.oracle.example.javapython.Main.createPygalRenderer(Main.java:65)
at com.oracle.example.javapython.Main.main(Main.java:27)
that is graal module resolution does not work for release jar, even though it should
sorry, but packaging as a single jar is not part of this example :) that is quite a bit more involved
yes, it is much more work
I guess the example code is doing it right by reading py source as stream
InputStreamReader code = new InputStreamReader(Main.class.getClassLoader().getResourceAsStream(SOURCE_FILE_NAME));
Source source;
try {
source = Source.newBuilder(PYTHON, code, SOURCE_FILE_NAME).build();
But because of py dependencies are complicated matter, this scenario maybe is not yet supported in GraalVM 21.1.0 version