Allen Lantz Allen Lantz - 1 year ago 71
Java Question

How to export all files and folders in resources folder in java

How in java code do i copy everything from src/main/resources directory into the curent working directory?

My Files

Answer Source

I think what you are looking for is what was already asked and answered.

    java.util.jar.JarFile jar = new java.util.jar.JarFile(jarFile);
    java.util.Enumeration enumEntries = jar.entries();
    while (enumEntries.hasMoreElements()) {
        java.util.jar.JarEntry file = (java.util.jar.JarEntry) enumEntries.nextElement(); f = new + + file.getName());
    if (file.isDirectory()) { // if its a directory, create it
        } is = jar.getInputStream(file); // get the input stream fos = new;
    while (is.available() > 0) {  // write contents of 'is' to 'fos'

How to write a Java program which can extract a JAR file and store its data in specified directory (location)?