简体   繁体   中英

JAR File not exececuting which is build by netbeans

I am a Beginner in Java GUI and am using Netbeans 7.3 to use Swing Components, the problem is that all was working fine, but one day when I Clicked Clean & Build and tested the JAR file, it was not executing, I ran it in the Netbeans and It is working fine.
Then I thought that it would be a problem of Build Properties so I compared build properties from a project which was working fine with Jar file but I cannot find any difference, The problem is that when I double-click the JAR file, no Error is shown, I tried many ways like executing it from cmd but It did'nt worked.
Can anyone help me out What could be missing, and one thing more that is I even tried to build my project on another computer through Netbeans but no use.

Try to open your .jar with winrar, and check if the classes are being added to the .jar, If they are not being added probably is a bug from netbeans, I would advise to install netbeans 7.2, and then open your project again, and then regenerate the Jar File. I was having a similar problem with Netbeans 7.3

I think you executing .jar file from different folder - not from where it was created? If so - that means your application can not find some files - pictures, etc. So if you have some files which application uses - create the folder named "lib" and place there your files - but not .jar file. For example:

File file = new File("/images/etc.png");

means that it is placed in lib/images directory. So your .jar file could be run from here:

C:/myTestApplications/myApp.jar

which contains also folder

C:/myTestApplications/lib/images

Try that.

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