All Downloads are FREE. Search and download functionalities are using the official Maven repository.

redis.embedded.util.JarUtil Maven / Gradle / Ivy

Go to download

Redis embedded server for Java integration testing. Project forked from https://github.com/kstyrc/embedded-redis

The newest version!
package redis.embedded.util;

import com.google.common.io.Files;
import com.google.common.io.Resources;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;

public class JarUtil {

    public static File extractExecutableFromJar(String executable) throws IOException {
        File tmpDir = Files.createTempDir();
        tmpDir.deleteOnExit();

        File command = new File(tmpDir, executable);
        FileUtils.copyURLToFile(Resources.getResource(executable), command);
        command.deleteOnExit();
        command.setExecutable(true);

        return command;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy