import-java
Import your Java packages seamlessly into CPython.
Quick Start
We'll create a temporary file in Java and then read it in Python to illustrate the usage:
>>> import java
>>> with java:
... from java.lang import String
... from java.nio.file import Files
...
>>> temp_path = Files.createTempFile('sample', '.tmp')
>>> sample_text = String('Greetings from Java')
>>> Files.write(temp_path, sample_text.getBytes())
<java.nio.file.Path at 0x... jclass=java/nio/file/Path jself=...>
>>> with open(temp_path.toString()) as f:
... print(repr(f.read()))
...
'Greetings from Java'
You can also use _ as a short alias for java.lang:
>>> with java:
... from _ import System
...
>>> System.getProperties().get('java.specification.version')
'1.8'
Wildcard imports (such as from java.util import *) are not supported yet.
Dependencies
Either PyJNIus or JavaBridge. PyJNIus is preferred, as JavaBridge cannot disambiguate overloaded methods with the same number of parameters.
Installation
$ pip install import-java
License
MIT.
See also
- pythonnet - Import .NET CLR modules
- hack-py-import - Import your C libraries
Metadata
Release files for import-java 0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| import-java-0.6.tar.gz | 4.3 kB | Without provenance | Details for import-java-0.6.tar.gz |
Release files / import-java-0.6.tar.gz
| Download URL | import-java-0.6.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31d742ef021b0036a287a817abbe7e2a4691bfd249fbe14b5d789a1387d24baa
|
|
BLAKE2b-256 checksum How to use checksums |
1e9d3af732663c61c0662b97db33b4d82d7d6f23f9f3ebe9f093a60c7ebf984a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for import-java 0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.