JWrapper to build java application

2.7k Views Asked by At

I tried to use Jwrapper to create exe from jar file that was created with JDeveloper. ezDBA- windows32-offline in build directory is not working. It only showed logo and then hung.

Can anyone please tell me what is wrong?

Batch file to run JWrapper: cd C:\JWrapper "C:\Program Files (x86)\Java\jre6\bin\java" -Xmx512m -jar jwrapper-00031607960.jar ezDBA\jwrapper-ezDBA.xml

JWrapper xml file which is modified from sample:

<?xml version="1.0"?>
-<JWrapper>
<!-- The name of the app bundle -->
<BundleName>ezDBA</BundleName>
<!-- The specification for one app within the bundle -->
-<App>
<Name>ezDBA</Name>
<LogoPNG>ezDBA/logo.png</LogoPNG>
<MainClass>ezDBA.ezDBA</MainClass>
<Param>one</Param>
<Param>two</Param>
</App>
<SupportedLanguages>en</SupportedLanguages>
<!-- App is a per-user app, it won't elevate and install for all users and the shared config    folder will be per-user -->
<!-- Splash and Logo -->
<SplashPNG>ezDBA/splash.png</SplashPNG>
<BundleLogoPNG>ezDBA/logo.png</BundleLogoPNG>
<!-- JVM options (e.g. extra memory) -->
-<JvmOptions>
<JvmOption>-Xmx556m</JvmOption>
</JvmOptions>
<!-- The JREs JWrapper should use for Windows, Linux32, Linux64... -->
<Windows32JRE>JRE-1.7/win32/jre1.7.0_05</Windows32JRE>
<Windows64JRE>JRE-1.7/win32/jre1.7.0_05</Windows64JRE>
<Linux32JRE>JRE-1.7/linux/jre1.7.0_13</Linux32JRE>
<Linux64JRE>JRE-1.7/linuxx64/jre1.7.0_13</Linux64JRE>
<Mac64JRE>JRE-1.7/macos64/jre1.7.0_45.jre</Mac64JRE>

ezDBA/ezDBA.jar

Application generated from JDeveloper with two files which runs ok with ezDBA.jar

ezDBA.java:

import java.awt.Dimension; 
import java.awt.Rectangle;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class ezDBA_Frame extends JFrame {
    private JLabel jLabel1 = new JLabel();

    public ezDBA_Frame() {
        try {
            jbInit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout( null );
        this.setSize( new Dimension(400, 300) );
        jLabel1.setText("This Is A Jwrapper Test");
        jLabel1.setBounds(new Rectangle(115, 90, 135, 30));
        this.getContentPane().add(jLabel1, null);
    }
}

And ezDBA_Frame.java:

package ezdba;

import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.UIManager;

public class ezDBA {

    public ezDBA() {
        JFrame frame = new ezDBA_Frame();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        frame.setLocation( ( screenSize.width - frameSize.width ) / 2, ( screenSize.height - frameSize.height ) / 2 );
        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        new ezDBA();
    }
}
2

There are 2 best solutions below

0
On

Do you see anything in the logs when your app is run:

http://www.jwrapper.com/guide-where-your-app-is-installed-and-logs.html

The order of run is:

Wrapper-... GenericUpdater-... YourVirtualAppName-...

If you look in the latest one based on that order (or just the one most recently created) you can look at the end to see if it logged any errors?

0
On

Assuming you have the correct tags to add your apps JAR to the JWrapper build I would say maybe you have the package ezDBA capitalised in the JWrapper XML but not in your source code?

So JWrapper is trying to launch ezDBA.ezDBA but instead you should configure it to launch ezdba.ezDBA?