Launch4j java.lang.ExceptionInInitializerError --- does not work and not supported

Asked by johnny doe on 2018-12-10

My jar file is working perfectly at command line, but when I try to make it to exe in Launch4j it outputs this error when I run it in Launch4j GUI

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
 at org.sikuli.script.FindInput2.<clinit>(FindInput2.java:17)
 at org.sikuli.script.Finder.<init>(Finder.java:23)
 at org.sikuli.script.Region.doCheckLastSeenAndCreateFinder(Region.java:2905)
 at org.sikuli.script.Region.checkLastSeenAndCreateFinder(Region.java:2866)
 at org.sikuli.script.Region.doFind(Region.java:2795)
 at org.sikuli.script.Region.access$300(Region.java:21)
 at org.sikuli.script.Region$RepeatableFind.run(Region.java:3075)
 at org.sikuli.script.Region$Repeatable.repeat(Region.java:3028)
 at org.sikuli.script.Region.wait(Region.java:2251)
 at org.sikuli.script.Region.wait(Region.java:2295)
 at org.sikuli.script.Region.getLocationFromTarget(Region.java:3270)
 at org.sikuli.script.Region.click(Region.java:3875)
 at org.sikuli.script.Region.click(Region.java:3860)
 at Main.actionPerformed(Main.java:32)
 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.plaf.basic.BasicButtonListener.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.dispatchEventImpl(Unknown Source)
 at java.awt.EventQueue.access$500(Unknown Source)
 at java.awt.EventQueue$3.run(Unknown Source)
 at java.awt.EventQueue$3.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
 at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
 at java.awt.EventQueue$4.run(Unknown Source)
 at java.awt.EventQueue$4.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(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)
Caused by: java.lang.NullPointerException
 at org.sikuli.script.RunTime.libsExport(RunTime.java:887)
 at org.sikuli.script.RunTime.libsLoad(RunTime.java:811)
 at org.sikuli.script.RunTime.loadLibrary(RunTime.java:969)
 at org.sikuli.script.Finder2.<clinit>(Finder2.java:33)
 ... 50 more
My java class:

import org.sikuli.android.ADBScreen;
import org.sikuli.script.FindFailed;
import org.sikuli.script.RunTime;
import org.sikuli.script.Screen;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Main extends JFrame implements ActionListener {
    private Screen screen = new Screen();
    public Main()
    {
        super.setVisible(true);
        super.setSize(250,250);
        super.setDefaultCloseOperation(3);
        JButton startButton=new JButton("Start");
        startButton.addActionListener(this);
        add(startButton);

    }

    public static void main(String[] args) {
        new Main();
    }

    @Override
    public void actionPerformed(ActionEvent e)
    {
        try
        {
            screen.click("/resources/images/fbTab.png");
        }
        catch (Exception ex)
        {
            JLabel label=new JLabel(ex.getMessage());
            add(label);
        }
    }
}

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
johnny doe
Solved:
2018-12-10
Last query:
2018-12-10
Last reply:
2018-12-10
RaiMan (raimund-hocke) said : #1

Sorry, but you have to find your own way - I do not support this.

I stopped experimenting with Launch4J with no success ever a year ago.

The problem area is the export of stuff from the sikulix jars to the outside world, which does not work in the Launch4J exe-packing-structure.

johnny doe (edison2214) said : #2

Ok my friend thanks for helping