Trouble Accessing Java Classes from Python Using GraalPy and GraalVM #448
-
Hello everyone, What I want to doI'm trying to access a Java class from a Python script using GraalPy (GraalPython) with GraalVM, but I'm encountering an error that I can't seem to resolve. Python Script (main.py)
Java Class(User.java)
I've compiled the Java class and packaged it into a JAR file named gpdemo-0.0.1-SNAPSHOT-plain.jar, and I set it as classpath for zshrc. Execution command
Error Message:
What I've Tried:
Environment Details:GraalVM Version: Oracle GraalVM 23.0.1+11.1 Questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
additionally, here is the contained classes which are showed by
|
Beta Was this translation helpful? Give feedback.
-
Hi @ShuzoShinagawa1102, the option for supplying classpath when running through the graalpy launcher is |
Beta Was this translation helpful? Give feedback.
I tried your example and it printed
Alice
with no errors. What I did:com/example/model/User.java
and your python code asmain.py
javac com/example/model/User.java
graalpy --vm.cp=. main.py
The differences I have from you is that I used the latest release, I'm on Linux and I didn't build a JAR. Could you please try the latest release (24.1.1, the
graalpy-jvm
variant)?