0

I have developed an application that basically searches its resources/runtime directory, looking for .java files.

Having fetched all .java sources, it (together with program arguments) passes their absolute paths to JavaCompiler.

Of course, this approach doesn't work when application is deployed as a JAR package. So the question - how can I work with resource files as with regular files, i.e. pass their absolute path and read them afterwards?

I found some related topics here:

But what if I don't know names of the files? I seek solution that allows me to search the resources/runtime directory. Moreover, I think making a copy of file somewhere and delete it later on is clumsy solution.

I use combination of Java and Scala (with sbt build system), hence solution Java or Scala would be great.

Community
  • 1
  • 1
petrbel
  • 2,428
  • 5
  • 29
  • 49
  • Can you clarify what you mean when you say the "resources/runtime" directory? Do you mean a directory within the jar file, or a directory external to the jar file? – Mike Curry Apr 04 '15 at 23:22
  • 1
    Probably a duplicate of http://stackoverflow.com/questions/1429172/how-do-i-list-the-files-inside-a-jar-file and/or http://stackoverflow.com/questions/5193786/how-to-use-classloader-getresources-correctly . – VGR Apr 05 '15 at 03:14

0 Answers0