property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy")
property "VERSION", JALVIEW_VERSION
property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]"
+ property "JAVA_COMPILE_VERSION", JAVA_INTEGER_VERSION
if (getdownSetAppBaseProperty) {
property "GETDOWNAPPBASE", getdownAppBase
property "GETDOWNAPPDISTDIR", getdownAppDistDir
label.backupfiles_confirm_save_new_saved_file_ok = The new saved file seems okay.
label.backupfiles_confirm_save_new_saved_file_not_ok = The new saved file might not be okay.
label.continue_operation = Continue operation?
+label.continue = Continue
label.backups = Backups
label.backup = Backup
label.backup_files = Backup Files
label.adjustments_for_this_computer = Adjustments for this computer
label.memory_example_text = Maximum memory that would be used with these settings on this computer
label.memory_example_tooltip = The memory allocated to Jalview is the smaller of the percentage of physical memory (default 90%) and the maximum absolute memory (default 32GB). If your computer's memory cannot be ascertained then the maximum absolute memory defaults to 8GB (if not customised).<br>Jalview will always try and reserve 512MB for the OS and at least 512MB for itself.
+warning.wrong_jvm_version_title = Wrong Java Version
+warning.wrong_jvm_version_message = The Java version being used (Java {0}) may lead to problems.\nThis installation of Jalview should be used with Java {1}.
label.backupfiles_confirm_save_new_saved_file_ok = El nuevo archivo guardado parece estar bien.
label.backupfiles_confirm_save_new_saved_file_not_ok = El nuevo archivo guardado podría no estar bien.
label.continue_operation = ¿Continuar operación?
+label.continue = Continua
label.backups = Respaldos
label.backup = Respaldo
label.backup_files = Archivos de respaldos
label.adjustments_for_this_computer = Ajustes para esta computadora
label.memory_example_text = Memoria máxima que se usaría con esta configuración en esta computadora
label.memory_example_tooltip = La memoria asignada a Jalview es el menor entre el porcentaje de memoria física (predeterminado 90%) y la memoria absoluta máxima (predeterminado 32 GB). Si no se puede determinar la memoria de su computadora, la memoria absoluta máxima predeterminada es de 8 GB (si no está personalizada).<br>Jalview siempre intentará reservar 512 MB para el sistema operativo y al menos 512 MB para sí mismo.
+warning.wrong_jvm_version_title = Versión incorrecta de Java
+warning.wrong_jvm_version_message = La versión de Java que se está utilizando (Java {0}) puede generar problemas.\nEsta instalación de Jalview debe usarse con Java {1}.
+
applicationProperties.put("VERSION",
buildProperties.getProperty("VERSION"));
}
+ if (buildProperties.getProperty("JAVA_COMPILE_VERSION", null) != null)
+ {
+ applicationProperties.put("JAVA_COMPILE_VERSION",
+ buildProperties.getProperty("JAVA_COMPILE_VERSION"));
+ }
} catch (Exception ex)
{
System.out.println("Error reading build details: " + ex);
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import jalview.schemes.ColourSchemeProperty;
import jalview.util.ChannelProperties;
import jalview.util.HttpUtils;
+import jalview.util.LaunchUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.ws.jws2.Jws2Discoverer;
* @j2sIgnore
*/
{
+
+ /**
+ * Check to see that the JVM version being run is suitable for the Java
+ * version this Jalview was compiled for. Popup a warning if not.
+ */
+ if (!LaunchUtils.checkJavaVersion())
+ {
+ Console.warn("The Java version being used (Java "
+ + LaunchUtils.getJavaVersion()
+ + ") may lead to problems. This installation of Jalview should be used with Java "
+ + LaunchUtils.getJavaCompileVersion() + ".");
+
+ if (!LaunchUtils
+ .getBooleanUserPreference("IGNORE_JVM_WARNING_POPUP"))
+ {
+ Object[] options = {
+ MessageManager.getString("label.continue") };
+ JOptionPane.showOptionDialog(null,
+ MessageManager.formatMessage(
+ "warning.wrong_jvm_version_message",
+ LaunchUtils.getJavaVersion(),
+ LaunchUtils.getJavaCompileVersion()),
+ MessageManager
+ .getString("warning.wrong_jvm_version_title"),
+ JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
+ null, options, options[0]);
+ }
+ }
+
if (!aparser.contains("nowebservicediscovery"))
{
desktop.startServiceDiscovery();
}
}
+ // Check if JVM and compile version might cause problems and log if it
+ // might.
+ if (headless && !Platform.isJS() && !LaunchUtils.checkJavaVersion())
+ {
+ Console.warn("The Java version being used (Java "
+ + LaunchUtils.getJavaVersion()
+ + ") may lead to problems. This installation of Jalview should be used with Java "
+ + LaunchUtils.getJavaCompileVersion() + ".");
+ }
+
// Move any new getdown-launcher-new.jar into place over old
// getdown-launcher.jar
String appdirString = System.getProperty("getdownappdir");
*/
package jalview.bin;
-import java.util.Locale;
-
import java.io.File;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import jalview.util.ChannelProperties;
import jalview.util.LaunchUtils;
*/
public static void main(String[] args)
{
+ if (!LaunchUtils.checkJavaVersion())
+ {
+ System.err.println("WARNING - The Java version being used (Java "
+ + LaunchUtils.getJavaVersion()
+ + ") may lead to problems. This installation of Jalview should be used with Java "
+ + LaunchUtils.getJavaCompileVersion() + ".");
+ }
+
final String javaBin = System.getProperty("java.home") + File.separator
+ "bin" + File.separator + "java";
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Properties;
public class LaunchUtils
{
return Boolean.parseBoolean(getUserPreference(key));
}
+
+ public static int JAVA_COMPILE_VERSION = 0;
+
+ public static int getJavaCompileVersion()
+ {
+ if (Platform.isJS())
+ {
+ return -1;
+ }
+ else if (JAVA_COMPILE_VERSION > 0)
+ {
+ return JAVA_COMPILE_VERSION;
+ }
+ String buildDetails = "jar:".concat(LaunchUtils.class
+ .getProtectionDomain().getCodeSource().getLocation().toString()
+ .concat("!" + "/.build_properties"));
+ try
+ {
+ URL localFileURL = new URL(buildDetails);
+ InputStream in = localFileURL.openStream();
+ Properties buildProperties = new Properties();
+ buildProperties.load(in);
+ in.close();
+ String JCV = buildProperties.getProperty("JAVA_COMPILE_VERSION",
+ null);
+ if (JCV == null)
+ {
+ System.out.println(
+ "Could not obtain JAVA_COMPILE_VERSION for comparison");
+ return -2;
+ }
+ JAVA_COMPILE_VERSION = Integer.parseInt(JCV);
+ } catch (MalformedURLException e)
+ {
+ System.err.println("Could not find " + buildDetails);
+ return -3;
+ } catch (IOException e)
+ {
+ System.err.println("Could not load " + buildDetails);
+ return -4;
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Could not parse JAVA_COMPILE_VERSION");
+ return -5;
+ }
+
+ return JAVA_COMPILE_VERSION;
+ }
+
+ public static int JAVA_VERSION = 0;
+
+ public static int getJavaVersion()
+ {
+ if (Platform.isJS())
+ {
+ return -1;
+ }
+ else if (JAVA_VERSION > 0)
+ {
+ return JAVA_VERSION;
+ }
+ try
+ {
+ String JV = System.getProperty("java.version");
+ if (JV == null)
+ {
+ System.out.println("Could not obtain java.version for comparison");
+ return -2;
+ }
+ if (JV.startsWith("1."))
+ {
+ JV = JV.substring(2);
+ }
+ JAVA_VERSION = JV.indexOf(".") == -1 ? Integer.parseInt(JV)
+ : Integer.parseInt(JV.substring(0, JV.indexOf(".")));
+ } catch (NumberFormatException e)
+ {
+ System.err.println("Could not parse java.version");
+ return -3;
+ }
+ return JAVA_VERSION;
+ }
+
+ public static boolean checkJavaVersion()
+ {
+ if (Platform.isJS())
+ {
+ return true;
+ }
+ String buildDetails = "jar:".concat(LaunchUtils.class
+ .getProtectionDomain().getCodeSource().getLocation().toString()
+ .concat("!" + "/.build_properties"));
+
+ int java_compile_version = getJavaCompileVersion();
+ int java_version = getJavaVersion();
+
+ if (java_compile_version <= 0 || java_version <= 0)
+ {
+ System.out.println("Could not make Java version check");
+ return true;
+ }
+ // Warn if these java.version and JAVA_COMPILE_VERSION conditions exist
+ // Usually this means a Java 11 compiled JAR being run by a Java 11 JVM
+ if (java_version >= 11 && java_compile_version < 11)
+ {
+ return false;
+ }
+
+ return true;
+ }
}