简体   繁体   English

使用JWrapper时发生异常

[英]Exception while using JWrapper

I'm trying to build an exe from jar file using jWrapper . 我正在尝试使用jWrapper从jar文件构建一个exe。 Why am i getting the error as shown in the below on trying to generate exe using JWrapper? 为什么在尝试使用JWrapper生成exe时出现如下所示的错误? pls help 请帮助

C:\Documents and Settings\Administrator>java  -jar G:\IMS\jwrapper-00018512673.j
ar  G:\IMS\app.xml
JWrapper 00018512673
JWrapperCompiler started
[Config] Building file is G:\IMS\app.xml
[Updates] Checking for updates...
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at SecureRunner2.<init>(SecureRunner2.java:464)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at SecureRunner1.<init>(SecureRunner1.java:422)
        at SecureRunner1.<init>(SecureRunner1.java:227)
        at SecureRunner1.main(SecureRunner1.java:52)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at jwrapper.launch.JWCompiler.main(JWCompiler.java:99)
Caused by: java.lang.NullPointerException
        at jwrapper.JWrapperCompiler.main(JWrapperCompiler.java:458)
        ... 17 more
[Updates] Update check: 18512673 vs 18473665 (online)

my app.xml file 我的app.xml文件

<JWrapper>

    <!-- This tells JWrapper the name of your app bundle -->
    <BundleName>MinimalApp</BundleName>

    <!-- This bit defines a virtual app - your app bundle can have one of these or a bunch of them -->
    <App>

        <!-- The name of the app that launches -->
        <Name>tx</Name>

        <!-- The logo for the app, we automatically scale and convert it to OS specific formats -->


        <!-- The Java main class for your app -->
        <MainClass>ims.init.Selector</MainClass>

        <!-- Any static parameters you want to pass in to your main method -->
        <Param>one</Param>
        <Param>two</Param>

    </App>

    <!-- This tells JWrapper what languages your app uses so JWrapper can let the user choose (if its more than one) -->
    <SupportedLanguages>en,fr</SupportedLanguages>

    <!-- If your app needs to run elevated (as admin) on Windows you can specify that here -->
    <WindowsElevation>None</WindowsElevation>

    <!-- This app installs itself for the current user, you can also install for all users or run as a temporary executable -->
    <InstallType>CurrentUser</InstallType>

    <!-- This is the optional update URL for the app, if the files here get updated the app will auto update-->
    <UpdateURL>http://minimal.jwrapper.com/</UpdateURL>



    <!-- Here's where you specify your Windows 32 bit JRE, note that you can use a 32 bit JRE on 64 bit Windows -->
    <Windows32JRE>../windows/jre1.6.0_16</Windows32JRE>
    <Windows64JRE>../windows/jre1.6.0_16</Windows64JRE>
    <Linux32JRE>../linux/jre1.6.0_16</Linux32JRE>
    <Linux64JRE>../linuxx64/jre1.6.0_16</Linux64JRE>

    <!-- Here's where you can add JAR files or whatever else your app needs to run -->
    <File classpath='yes'>lib/*.jar</File>
    <File classpath='no' path='translations.properties'>resources/translation.properties</File>

</JWrapper>

Had the same problem. 有同样的问题。 In my case it was from the JRE that was NOT included in the jwrapper.jar. 在我的情况下,jwrapper.jar中没有包含来自JRE的内容。 I downloaded a Windows JRE6 from here (read somewhere that JRE7 is not cool to include?)and copied the full jre6 directory to my jwrapper directory. 从这里下载了Windows JRE6(读过包含JRE7并不酷的地方?),然后将完整的jre6目录复制到了我的jwrapper目录中。 Same for linux from here . 这里开始,与Linux相同。 Windows just 32bit, Linux 32 and 64 bit. Windows仅32位,Linux 32和64位。

<!-- Here's where you specify your Windows 32 bit JRE, note that you can use a 32 bit JRE on 64 bit Windows -->
<Windows32JRE>jre6</Windows32JRE>
<Windows64JRE>jre6</Windows64JRE>
<Linux32JRE>jre1.7.0_17_32</Linux32JRE>
<Linux64JRE>jre1.7.0_17_64</Linux64JRE>

my problem is now that the current working directory is not the same as the .exe is placed. 我的问题是,当前的工作目录与放置的.exe不同。 maybe i can find a solution for this also. 也许我也可以找到解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM