• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

finding files in a jar

 
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am creating an application that creates executable jars. This application is itself a jar. There are class files inside the application jar that need to be put into the created executable jar. How do I get to these class files?
Please refrain from suggesting I use Ant or IZPack or anything similar. They are not appropriate for my specific needs.
Thanks!
------------------
Jason R. Kretzer
Java Programmer
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so it's about extracting files from a jar?
can you try
using the method
getResourceAsStream() in java.lang.ClassLoader
yourClass.class.getClassLoader().getResourceAsStream() and use that inputstream.
I presume that the start up application(jar file) is in classpath and has a main which start creating other jars.
karthik

Originally posted by Jason Kretzer:
I am creating an application that creates executable jars. This application is itself a jar. There are class files inside the application jar that need to be put into the created executable jar. How do I get to these class files?
Please refrain from suggesting I use Ant or IZPack or anything similar. They are not appropriate for my specific needs.
Thanks!


 
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic