Question

I'm developing some custom screens and custom actions and would like to create associations between them in much the same way that adding a "Create program group" screen suggests adding a "Create program group" action.

So I have a screen, and would like to associate an action with it. The action should be placed on the Installation screen. Within the screens bean info class, I've added the following line to the constructor:

setAssociatedAction(MyAction.class.getName(), InstallationScreen.class.getName());

This doesn't seem to do anything. I recompile, and re-add the screen to the installer, but it doesn't prompt me to add the action. I tried adding the same settings to the action's constructor, thinking that perhaps both need to create an association with each other to work:

setAssociatedScreen(MyScreen.class.getName());
setInstallerTargetScreen(InstallationScreen.class.getName());

It didn't help either. I even tried doing the reverse by creating the action to see if it requests that the screen be created as well, but no luck there. Luckily, setting the installer target screen worked as expected.

I've tried the following as well:

  • Simple and canonical names for the class name.
  • The bean info classes, just incase.

I'm not sure what I'm doing wrong, if I am doing anything wrong. The documentation doesn't elude to any additional dependencies:

Hopefully this isn't a bug.

Thanks in advance!

EDIT:

I was about to resolve this, but only as an extension to install4j. I used the wrong class when specifying the Bean class in the BeanInfo.

I had:

public MyActionBeanInfo() {
      super("Title", "Description", "Category", false, true, null, MyActionBeanInfo.class);
}

Instead of:

public MyActionBeanInfo() {
      super("Title", "Description", "Category", false, true, null, MyAction.class);
}

As a small enhancement, would it be possible to throw an exception, perhaps an IllegalArgumentException, from the super constructor if it is not a valid Bean class?

BUT!

I still received a ClassNotFound and NullPointer exception when not used as an extension.

Here's the stack trace:

java.lang.ClassNotFoundException: com.geowareinc.util.installer.actions.MyAction
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.install4j.gui.views.installer.d.g.a(ejt:92)
    at com.install4j.gui.views.installer.i.b.a(ejt:41)
    at com.install4j.gui.views.installer.i.b.a(ejt:31)
    at com.install4j.gui.views.installer.i.b.a(ejt:18)
    at com.install4j.gui.views.installer.d.h.a(ejt:34)
    at com.install4j.gui.views.installer.d.h.call(ejt:32)
    at com.install4j.gui.views.installer.d.ax.a(ejt:1238)
    at com.install4j.gui.views.installer.d.g.a(ejt:32)
    at com.install4j.gui.views.installer.b.h.a(ejt:388)
    at com.install4j.gui.views.installer.d.ax.f(ejt:691)
    at com.install4j.gui.views.installer.d.bd.actionPerformed(ejt:540)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NullPointerException
    at sun.reflect.misc.ReflectUtil.checkPackageAccess(Unknown Source)
    at sun.reflect.misc.ReflectUtil.isPackageAccessible(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at com.install4j.gui.views.installer.d.g.b(ejt:60)
    at com.install4j.gui.views.installer.i.b.a(ejt:73)
    at com.install4j.gui.views.installer.i.b.a(ejt:53)
    at com.install4j.gui.views.installer.i.b.a(ejt:31)
    at com.install4j.gui.views.installer.i.b.a(ejt:18)
    at com.install4j.gui.views.installer.d.h.a(ejt:34)
    at com.install4j.gui.views.installer.d.h.call(ejt:32)
    at com.install4j.gui.views.installer.d.ax.a(ejt:1238)
    at com.install4j.gui.views.installer.d.g.a(ejt:32)
    at com.install4j.gui.views.installer.b.h.a(ejt:388)
    at com.install4j.gui.views.installer.d.ax.f(ejt:691)
    at com.install4j.gui.views.installer.d.bd.actionPerformed(ejt:540)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Was it helpful?

Solution

This is a bug in install4j. Associated screens and actions cannot be loaded if the bean is added on the Installer->Custom code & Resources tab.

This will be fixed in 5.1.7.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top