import com.oracle.bundlers.Bundlers; import com.sun.javafx.tools.packager.bundlers.BundleParams; import com.sun.javafx.tools.packager.bundlers.ConfigException; import com.sun.javafx.tools.packager.bundlers.RelativeFileSet; import com.sun.javafx.tools.packager.bundlers.UnsupportedPlatformException; import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; /** * * @author Dmitry Ginzburg */ public class BundlerTestApp { static Bundlers bundlers = Bundlers.createBundlersInstance(); public static void main(String[] args) { System.out.println("File exists = " + new File("/tmp/BundlerTestApp.jar").exists()); Map params = new HashMap<>(); params.put(BundleParams.PARAM_APP_RESOURCES, new RelativeFileSet(new File("/tmp"), new HashSet<>(Arrays.asList(new File("/tmp/BundlerTestApp.jar"))))); params.put(BundleParams.PARAM_COPYRIGHT, "Lorem ipsum..."); params.put(BundleParams.PARAM_LICENSE_TYPE, "GNU GPL 2.0"); params.put(BundleParams.PARAM_LICENSE_FILES, Arrays.asList("hello world")); bundlers.getBundlers() .stream() .filter(b -> { return "rpm".equalsIgnoreCase(b.getID()); }) .forEach(bundler -> { try { bundler.validate(params); } catch (UnsupportedPlatformException ex) { } catch (ConfigException ex) { ex.printStackTrace(); System.out.println("bundler.getID() = " + bundler.getID()); System.exit(1); } System.out.println("[No config exception]"); System.out.println("executing: " + bundler.getID()); bundler.execute(params, new File("/tmp")); }); } }