简体   繁体   中英

Netbeans generated jar file not working

I have the initial code generated by netbeans in the new JFrame Form which shows the following output when run:- 在此处输入图片说明

But, when I run the jar file in the dist folder, I get the following:- 在此处输入图片说明

How, to solve this problem? Any help will be appreciated.

You will need to edit your build.xml so that all your used libraries are included in the build process. This will look something like this in build.xml:

<target name="-post-jar">
    <echo>Adding jar: ${reference.myMissingJar.jar}</echo>
    <jar update="true" destfile="${dist.jar}">
        <zipfileset src="${reference.myMissingJar.jar}"/>
    </jar>
    <mkdir dir="bin"/>
    <copy file="${dist.jar}" todir="bin" description="Copy jar file."/>
 </target>

The problem is that while you try to run it in netbeans, the IDE knows about all those nifty libs you use. When using a single jar, that is something different altogether.

Alternativly you might want to state the locations of your used libs in your classpath parameter.

In netbeans do a Clean and build project (shift + f11) Netbeans清理并构建项目 if that doesnt help please post more details. Are u using external libs?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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