# \[Bug-14302\]Bundled JRE (Azul Java) does not allow java packages to be imported in the same way

**URL:** <https://forum.inductiveautomation.com/t/bug-14302-bundled-jre-azul-java-does-not-allow-java-packages-to-be-imported-in-the-same-way/26055>\
**Category:** Ignition\
**Created:** [June 24, 2019, 11:29am UTC](https://forum.inductiveautomation.com/t/bug-14302-bundled-jre-azul-java-does-not-allow-java-packages-to-be-imported-in-the-same-way/26055 "2019-06-24T11:29:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [June 24, 2019, 11:29am UTC](https://forum.inductiveautomation.com/t/bug-14302-bundled-jre-azul-java-does-not-allow-java-packages-to-be-imported-in-the-same-way/26055/1 "2019-06-24T11:29:01Z")

</div>

Due to [this issue](http://forum.inductiveautomation.com/t/client-launcher-uses-azul-java-even-with-usebundledjre-false/26054/2), 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:

```auto
> import java
> java.awt.Component
AttributeError: 'javapackage' object has no attribute 'awt'

```

```auto
> 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?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 24, 2019, 12:30pm UTC](https://forum.inductiveautomation.com/t/bug-14302-bundled-jre-azul-java-does-not-allow-java-packages-to-be-imported-in-the-same-way/26055/2 "2019-06-24T12:30:03Z")

</div>

> [@systemparadox](#):
>
> Is this a bug, or is this not really supported and only worked by accident?

Only worked by accident. Java doesn't expose a way to enumerate classes in packages, so the jython interpreter can only guarantee imports that specify names all the way down to the class name. Like so:

```auto
import java.lang.Exception
from java.util import Date

```

---

<div class="post-metadata">

**Author:** ![systemparadox](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@systemparadox](https://forum.inductiveautomation.com/u/systemparadox)\
**Post date:** [June 24, 2019, 1:07pm UTC](https://forum.inductiveautomation.com/t/bug-14302-bundled-jre-azul-java-does-not-allow-java-packages-to-be-imported-in-the-same-way/26055/3 "2019-06-24T13:07:21Z")

</div>

That’s interesting because I don’t seem to have any issues with enumeration of classes, just subpackages.

This works fine:

```python
import java.lang
print java.lang.Exception

```

---

<div class="post-metadata">

**Author:** ![ggross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ggross/32/12668_2.png) [@ggross](https://forum.inductiveautomation.com/u/ggross)\
**Post date:** [June 26, 2019, 4:56pm UTC](https://forum.inductiveautomation.com/t/bug-14302-bundled-jre-azul-java-does-not-allow-java-packages-to-be-imported-in-the-same-way/26055/4 "2019-06-26T16:56:24Z")

</div>

We are seeing other issues internally that are similar in nature to this issue. We have an open ticket investigating this and I am adding this information to the ticket.

Thanks,  
Garth
