- Notifications
You must be signed in to change notification settings - Fork130
Trouble Accessing Java Classes from Python Using GraalPy and GraalVM#448
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
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:
|
BetaWas this translation helpful?Give feedback.
All reactions
I tried your example and it printedAlice
with no errors. What I did:
- Save your java code as
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, thegraalpy-jvm
variant)?
Replies: 2 comments 3 replies
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
additionally, here is the contained classes which are showed by
|
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi@ShuzoShinagawa1102, the option for supplying classpath when running through the graalpy launcher is |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@msimacek Thank you for pointing that out. It was just a typo on my part, and I am indeed using "--vm.cp" when runnng the command. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I tried your example and it printed
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 |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
@msimacek I installed GraalPy latest release version (24.1.1) that you suggested (https://github.com/oracle/graalpython/releases) and it worked.
|
BetaWas this translation helpful?Give feedback.