Due to this issue, we are currently in the unenviable position of having to support both the system-installed Java version and the bundled Azul Java.
The first issue I’ve encountered is that Azul Java doesn’t support importing java packages the way we have been doing:
> import java
> java.awt.Component
AttributeError: 'javapackage' object has no attribute 'awt'
> import java
> from java import awt
ImportError: cannot import name awt
Both of these methods have always worked with Oracle Java or OpenJDK, but they don’t with Azul Java.
The workaround is to do import java.awt
, which seems to load the package correctly. The same issue appears to happen with all subpackages, for example javax.swing
and java.util
. It also happens if you import java.awt
but then try to use java.awt.color
, until you also import java.awt.color
.
Is this a bug, or is this not really supported and only worked by accident?