/*
 * This file is part of Sponge, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.launch;

import java.awt.GraphicsEnvironment;

import javax.swing.JOptionPane;

public class JavaVersionCheckUtils {

    private static final String REQUIRED_VERSION = "1.8.0_40";

    private static final String ERROR_MESSAGE = "We have detected that you are JRE version %s, which is out of date!\n"
            + "In order to run Sponge, you **must** be running JRE version %s (or above).\n"
            + "Previous builds of JRE version 1.8 will not work with Sponge.\n"
            + "This can be downloaded from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html";

    public static void ensureJava8() {
        String version = getCurrentVersion();
        String runtimeVersion = System.getProperty("java.runtime.version");
        boolean incompatible = false;
        if (version.compareTo(REQUIRED_VERSION) < 0) {
            incompatible = true;
        }
        if (runtimeVersion.contains("8u"))
        if (incompatible) {
            String error = String.format(ERROR_MESSAGE, version, REQUIRED_VERSION);

            if (!GraphicsEnvironment.isHeadless()) {
                JOptionPane.showMessageDialog(null, error, "PEBKACException!", JOptionPane.ERROR_MESSAGE);
            }
            throw new RuntimeException(error);
        }
    }

    private static String getCurrentVersion() {
        return System.getProperty("java.runtime.version");
    }
}

@@ -1565,24 +1565,60 @@
 of date!%5Cn%22%0A
+                                    
             
@@ -1694,24 +1694,60 @@
  above).%5Cn%22%0A
+                                    
             
@@ -1810,24 +1810,60 @@
  Sponge.%5Cn%22%0A
+                                    
             
@@ -2085,279 +2085,51 @@
     
-String runtimeVersion = System.getProperty(%22java.runtime.version%22);%0A        boolean incompatible = false;%0A        if (version.compareTo(REQUIRED_VERSION) %3C 0) %7B%0A            incompatible = true;%0A        %7D%0A        if (runtimeVersion.contains(%228u%22))%0A        if (incompatible
+if (version.compareTo(REQUIRED_VERSION) %3C 0
 ) %7B%0A
@@ -2543,16 +2543,8 @@
 ava.
-runtime.
 vers

Revert changes to JavaVersionCheckUtils as they were unintended.