public static String install(String forgeUrl, boolean isServer)
			throws IOException, ClassNotFoundException, NoSuchMethodException,
			IllegalAccessException, InvocationTargetException {
		String forgeFileName = UrlUtils.fileName(forgeUrl);

		String forgeVersionId = null;
		if (!isServer) {
			forgeVersionId = Minecraft.findForgeProfile();
			if (forgeVersionId != null) {
				// sample 1.6.4-Forge9.11.1.953
				String forgeVersion = forgeVersionId.replace("-Forge", "-");
				if (forgeFileName.contains(forgeVersion))
					return forgeVersionId;
			}
		}

		File tmp = File.createTempFile("forge", ".jar");
		tmp.deleteOnExit();
		try (InputStream is = new URL(forgeUrl).openStream()) {
			StreamUtils.saveTo(is, tmp);
		}

		String[] args;
		if (isServer)
			args = new String[] { "installServer" };
		else
			args = new String[0];

		// Launch.jar(tmp, args);
		
		//very messy code
		//start
		try {
			
			Process p = Runtime.getRuntime().exec(
					"java -jar " + "\"" + tmp.getAbsolutePath() + "\" ");
			BufferedReader input = new BufferedReader(new InputStreamReader(
					p.getInputStream()));

			String line = null;

			while ((line = input.readLine()) != null) {
				System.out.println(line);
			}

			p.waitFor();
			if (p.exitValue() != 0) {
				System.out.println("forge error" + p.exitValue());
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//end
		if (!isServer) {
			forgeVersionId = Minecraft.findForgeProfile();
		}

		return forgeVersionId;
	}