I need to package some files with different extensions and wrap it inside an installer.exe file. The end user should be able to get all the wrapped files once he/she runs the .exe file.

The above mentioned process should happen during run time (eg: once a REST API is called, all the required files should be picked and wrapped inside an installer.exe).

I have already tried to use the launch4j tool but it doesn't help at runtime, but it only works for compile time wrapping.

public class ApplicationMain extends JDialog {
    private static final long serialVersionUID = 1L;

    public ApplicationMain() {

        File source = new File("C:\\Users\\AGH\\Downloads\\abc - Copy.jar");
        File dest = new File("C:\\Users\\AGH\\Downloads\\newFile.jar");

        File source2 = new File("C:\\Users\\AGH\\Downloads\\pic.JPG");
        File dest2 = new File("C:\\Users\\AGH\\Downloads\\copy2.JPG");

        try {
            FileUtils.copyFile(source, dest);
            FileUtils.copyFile(source2, dest2);
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }

    public static void main(final String[] args) {
        new ApplicationMain();
    }
}

0 Answers