rubicon-java
rubicon-java copied to clipboard
Segmentation fault (core dumped) when instantiating the JavaClass
Describe the bug
I'm not able to instantiate the JavaClass
. Segmentation fault (core dumped)
To Reproduce Steps to reproduce the behavior:
- Cloned the repository;
- Installed the package locally
- Ran
make
- Had to set
librubicon.so
inRUBICON_LIBRARY
environment variable - When I entered the python shell and tried to instantiate the
rubicon.java.JavaClass
the error happened
Screenshots
Environment:
- Operating System: Ubuntu 20.04.2 LTS
- Python version: 3.8.10
Additional context I didn't try to install the Briefcase or Toga yet
This isn't a bug - it's a feature that isn't currently implemented.
There are two ways to approach the sort of bridge that Rubicon-Java provides:
-
Embed Python in to the Java Virtual Machine.
-
Embed a Java Virtual Machine into a running Python process.
Rubicon Java currently implements (1), as this is the mode that is required to implement Android applications. When you run the test suite, it starts a Java app (org.beeware.rubicon.test.Test
), which starts a Python VM and runs the unitest suite as Python code.
AFAIK, there's nothing that fundamentally prevents (2) from being implement - it's just a mode of operation that isn't currently supported. It should be relatively straightforward to implement - add a wrapped entry point that instantiates a Java VM (using JNI_CreateJavaVM()
) and ensures that the Python method invocation handler is installed. In fact, it would make running the test suite easier, as we would be able to use all the features of Python's test tooling, rather than just the features that are proxied through the Java test wrapper. However, it's not currently a high priority as (a) we have a working test suite, and (b) the 'embedded python' approach is our primary use case.