How do you make a Zip/Jar in Java that will not contain the absolute pathname
问题 I'm generating a .jar file in Java, but the .jar contains an absolute pathname of where it is in the system (/tmp/tempXXX/foo instead of /foo). The tree is like this: . |-- META-INF |-|- .... |-- tmp |-|- tempXXX |-|-|- foo |-|-|- bar Instead of this: . |-- META-INF |-|- .... |-- foo |-- bar Is it possible to fix this? Here is the function that makes it: public static void add(File source, JarOutputStream target, String removeme) throws IOException { BufferedInputStream in = null; try { File