我尝试使用 Jwrapper 从 JDeveloper 创建的 jar 文件中创建 exe。构建目录中的 ezDBA-windows32-offline 不起作用。它只显示徽标,然后挂起。
谁能告诉我出了什么问题?
运行 JWrapper 的批处理文件: cd C:\JWrapper "C:\Program Files (x86)\Java\jre6\bin\java" -Xmx512m -jar jwrapper-00031607960.jar ezDBA\jwrapper-ezDBA.xml
从示例修改的 JWrapper xml 文件:
<?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
从 JDeveloper 生成的应用程序有两个文件,可以使用 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);
}
}
以及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();
}
}