public static void buildModulesPackage(List<String> modulesNames) {
		System.out.println(System.getProperty("user.dir"));
		try {
			String baseDir = System.getProperty("user.dir");
			List<File> filesArray = new ArrayList<>();
			for (String module : modulesNames) {
				module = "/"+module.replace(".", "/")+".class";
				filesArray.add(new File(baseDir+module));
			}
			String output = System.getProperty("user.home") + "/modules.jar";

			Manifest manifest = new Manifest();
			manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,
					"1.0");
			manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_URL,
					"http://samoa.yahoo.com");
			manifest.getMainAttributes().put(
					Attributes.Name.IMPLEMENTATION_VERSION, "0.1");
			manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR,
					"Yahoo");
			manifest.getMainAttributes().put(
					Attributes.Name.IMPLEMENTATION_VENDOR_ID, "SAMOA");

			BufferedOutputStream bo;

			bo = new BufferedOutputStream(new FileOutputStream(output));
			JarOutputStream jo = new JarOutputStream(bo, manifest);

			File[] files = filesArray.toArray(new File[filesArray.size()]);
			addEntries(jo,files, baseDir, "");

			jo.close();
			bo.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
public static void buildModulesPackage ( List < String > modulesNames ) { System . out . println ( System . getProperty ( "user.dir" ) ) ; try { String baseDir = System . getProperty ( "user.dir" ) ; List < File > filesArray = new ArrayList < > ( ) ; for ( String module : modulesNames ) { module = "/" + module . replace ( "." , "/" ) + ".class" ; filesArray . add ( new File ( baseDir + module ) ) ; } String output = System . getProperty ( "user.home" ) + "/modules.jar" ; Manifest manifest = new Manifest ( ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . MANIFEST_VERSION , "1.0" ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . IMPLEMENTATION_URL , "http://samoa.yahoo.com" ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . IMPLEMENTATION_VERSION , "0.1" ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . IMPLEMENTATION_VENDOR , "Yahoo" ) ; manifest . getMainAttributes ( ) . put ( Attributes . Name . IMPLEMENTATION_VENDOR_ID , "SAMOA" ) ; BufferedOutputStream bo ; bo = new BufferedOutputStream ( new FileOutputStream ( output ) ) ; JarOutputStream jo = new JarOutputStream ( bo , manifest ) ; File [ ] files = filesArray . toArray ( new File [ filesArray . size ( ) ] ) ; addEntries ( jo , files , baseDir , "" ) ; jo . close ( ) ; bo . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
TODO should get the modules file from the parameters