• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Single jar deployment

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When using Netbeans 7.0.1, deploying a gui desktop application is as simple as hitting the 'hammer and broom' icon, which says 'clean and build main project'. However this does not produce a single jar file. Instead you get a lib folder as well where various dependency jar files are lodged. I wish to deploy a single jar file. So no lib folder. Just a single executable jar file. How can I do this??

I already tried the solution found at this site:
http://192.9.162.55/developer/technicalArticles/java_warehouse/single_jar/

But it does not work. Any ideas?
 
Ranch Hand
Posts: 334
2
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That works for me (as i said on the NetBeans forum).

What kind of problems are you having?

A couple of things to note.
  • You can't just cut and paste that code into your build.xml file you have some editing to do
  • That script is not automaically run when you clean and build you have to explicitly run it
  • That script does not merge manifests so if you put something significant in there you have to make sure the main manifiest goes in last


  • I wish NetBeans would take care of this like Eclipse does but it seems to violate someones sense of fair play. I suppose some of the libraries may not have licenses that allow this.

    Joe
     
    john gere
    Greenhorn
    Posts: 22
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Are you suggesting that I have to clean and build my project, then save this script to a build.xml and run 'ant' from the command line? That I have not done. I assumed I had to copy and paste to either the build.xml or the build-impl.xml. I actually tried both and it failed. So now I guess I have to run a 'clean and build' in netbeans, then put this script in a build xml file in the dist folder and then run it from the command line using ant. Given that ant looks for a build file, I just have to type in ant.

    Is that about correct??
     
    Joe Areeda
    Ranch Hand
    Posts: 334
    2
    Netbeans IDE Tomcat Server Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    arima kidd wrote:Are you suggesting that I have to clean and build my project, then save this script to a build.xml and run 'ant' from the command line? That I have not done. I assumed I had to copy and paste to either the build.xml or the build-impl.xml. I actually tried both and it failed. So now I guess I have to run a 'clean and build' in netbeans, then put this script in a build xml file in the dist folder and then run it from the command line using ant. Given that ant looks for a build file, I just have to type in ant.

    Is that about correct??

    Not quite.

    Once you put it in the build.xml script it will stay there. I do not modify build-impl.xml I think that one does get recreated when you change project parameters but I'm sure the build.xml does not.

    What I do (and I don't claim it's the best let alone the only way) is clean an build, then right click on build.xml in the Files view (I know) and choose Run Target -> Run Other Target-> Package for Store.

    There is probably a better way but by the time I'm ready to do this, I usually don't have enough energy left to look for one.

    Joe
     
    john gere
    Greenhorn
    Posts: 22
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks a million. WoW! I never thought I would get such an easy and simple solution. Was about to brace myself for a few days reading on using Ant with OneJar. Thanks again.! Now it's off to learning how to sign my jars for copyright purposes.
     
    Joe Areeda
    Ranch Hand
    Posts: 334
    2
    Netbeans IDE Tomcat Server Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    You're welcome.

    Joe
     
    reply
      Bookmark Topic Watch Topic
    • New Topic