// Path: src/main/java/com/github/sbugat/rundeckmonitor/tools/EnvironmentTools.java
// public final class EnvironmentTools {
// 
// 	/** SLF4J XLogger. */
// 	private static final XLogger LOG = XLoggerFactory.getXLogger(EnvironmentTools.class);
// 
// 	/** Windows OS name property. */
// 	private static final String OS_NAME_PROPERTY = "os.name"; //$NON-NLS-1$
// 	/** Windows name in OS name property. */
// 	private static final String WINDOWS_OS_NAME = "windows"; //$NON-NLS-1$
// 
// 	/**
// 	 * Private constructor to prevent Instantiating.
// 	 */
// 	private EnvironmentTools() {
// 		throw new UnsupportedOperationException();
// 	}
// 
// 	/**
// 	 * Check if the operating system is a windows based on a property, otherwise it's a Linux/Mac-OS.
// 	 *
// 	 * @return true if the OS is a windows*
// 	 */
// 	public static boolean isWindows() {
// 
// 		LOG.entry();
// 		final String operatingSystem = System.getProperty(OS_NAME_PROPERTY);
// 
// 		if (null == operatingSystem) {
// 			LOG.exit(false);
// 			return false;
// 		}
// 
// 		final boolean isWindows = operatingSystem.toLowerCase(Locale.getDefault()).startsWith(WINDOWS_OS_NAME);
// 		LOG.exit(isWindows);
// 		return isWindows;
// 	}
// }


import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.swing.JOptionPane;
import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.RepositoryTag;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
import com.github.sbugat.rundeckmonitor.tools.EnvironmentTools;
	/**
	 * Download a file/URL and write it to a destination file.
	 *
	 * @param inputStream source stream
	 * @param destinationFile destination file
	 * @throws IOException in case of copy error
	 */
	private static void downloadFile(final InputStream inputStream, final String destinationFile) throws IOException {

		Files.copy(inputStream, Paths.get(destinationFile));
	}

	/**
	 * Get the java executable.
	 *
	 * @return absolte path to the java executable
	 * @throws NoSuchFileException if the java executable is not found
	 */
	private static String getJavaExecutable() throws NoSuchFileException {

		LOG.entry();

		final String javaDirectory = System.getProperty(JAVA_HOME_PROPERTY);

		if (javaDirectory == null) {
			throw new IllegalStateException(JAVA_HOME_PROPERTY);
		}

		final String javaExecutableFilePath;
		// Add .exe extension on Windows OS
// Path: src/main/java/com/github/sbugat/rundeckmonitor/tools/EnvironmentTools.java
// public final class EnvironmentTools {
// 
// 	/** SLF4J XLogger. */
// 	private static final XLogger LOG = XLoggerFactory.getXLogger(EnvironmentTools.class);
// 
// 	/** Windows OS name property. */
// 	private static final String OS_NAME_PROPERTY = "os.name"; //$NON-NLS-1$
// 	/** Windows name in OS name property. */
// 	private static final String WINDOWS_OS_NAME = "windows"; //$NON-NLS-1$
// 
// 	/**
// 	 * Private constructor to prevent Instantiating.
// 	 */
// 	private EnvironmentTools() {
// 		throw new UnsupportedOperationException();
// 	}
// 
// 	/**
// 	 * Check if the operating system is a windows based on a property, otherwise it's a Linux/Mac-OS.
// 	 *
// 	 * @return true if the OS is a windows*
// 	 */
// 	public static boolean isWindows() {
// 
// 		LOG.entry();
// 		final String operatingSystem = System.getProperty(OS_NAME_PROPERTY);
// 
// 		if (null == operatingSystem) {
// 			LOG.exit(false);
// 			return false;
// 		}
// 
// 		final boolean isWindows = operatingSystem.toLowerCase(Locale.getDefault()).startsWith(WINDOWS_OS_NAME);
// 		LOG.exit(isWindows);
// 		return isWindows;
// 	}
// }


// Path: src/main/java/com/github/sbugat/rundeckmonitor/VersionChecker.java
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.swing.JOptionPane;
import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.RepositoryTag;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
import com.github.sbugat.rundeckmonitor.tools.EnvironmentTools;

	/**
	 * Download a file/URL and write it to a destination file.
	 *
	 * @param inputStream source stream
	 * @param destinationFile destination file
	 * @throws IOException in case of copy error
	 */
	private static void downloadFile(final InputStream inputStream, final String destinationFile) throws IOException {

		Files.copy(inputStream, Paths.get(destinationFile));
	}

	/**
	 * Get the java executable.
	 *
	 * @return absolte path to the java executable
	 * @throws NoSuchFileException if the java executable is not found
	 */
	private static String getJavaExecutable() throws NoSuchFileException {

		LOG.entry();

		final String javaDirectory = System.getProperty(JAVA_HOME_PROPERTY);

		if (javaDirectory == null) {
			throw new IllegalStateException(JAVA_HOME_PROPERTY);
		}

		final String javaExecutableFilePath;
		// Add .exe extension on Windows OS
		if (EnvironmentTools.isWindows()) {