Jar file hierarchy missing folders like res and src (using jar tf)

Viewed 35

I've been working on packaging my res files into my Jar file using eclipse. When I export as a runnable jar or try and use Runtime.getRuntime().exec(); I get the correct directories, just missing the res/ or src/, etc, which would be a pain to code around. The hierarchy looks something like this:

Project
  src
    main
      Main.java
    package_A
      thing1.java
      thing2.java
    package_B
      other_thing1
      other_thing2
    package_C
      …
    package_D
      …
  res
    folder_A
      image_1.png
      image_2.png
      image_3.png
    folder_B
      image_4.png
      image_5.png
    folder_C
      image_6.png
      image_7.png
      image_8.png
      image_9.png
  bin

When I run this command as a Runnable Jar File, I get something like this

main/Main.java
packageA/thing1.java
packageA/thing2.java
packageB/other_thing1.java
packageB/other_thing2.java
…
folder_A/image_1.png
folder_A/image_2.png
folder_A/image_3.png
folder_B/image_4.png
folder_B/image_5.png
folder_C/image_6.png
folder_C/image_7.png
folder_C/image_8.png
folder_C/image_9.png

No bin, no res, no src. Is this just how it is or is it permanent? If not, how do I fix this?

Edit: Finally fixed it after many many hours. I had to use getClass().getResource(curPath).toExternalForm() among many others.

0 Answers
Related