Update version warnings

Add OpenJDK check for ARM
Uncomment SystemVersion.main()
This commit is contained in:
zzz
2016-04-16 15:53:34 +00:00
parent 5a2975ba65
commit 25fe886e72
3 changed files with 23 additions and 7 deletions

View File

@ -292,8 +292,10 @@ public class RouterConsoleRunner implements RouterApp {
/** @since 0.9.17 */ /** @since 0.9.17 */
private void checkJavaVersion() { private void checkJavaVersion() {
boolean noJava7 = !SystemVersion.isJava7(); boolean noJava7 = !SystemVersion.isJava7();
boolean noPack200 = !FileUtil.isPack200Supported(); boolean noPack200 = (PluginStarter.pluginsEnabled(_context) || !NewsHelper.isUpdateDisabled(_context)) &&
if (noJava7 || noPack200) { !FileUtil.isPack200Supported();
boolean openARM = SystemVersion.isARM() && SystemVersion.isOpenJDK();
if (noJava7 || noPack200 || openARM) {
String s = "Java version: " + System.getProperty("java.version") + String s = "Java version: " + System.getProperty("java.version") +
" OS: " + System.getProperty("os.name") + ' ' + " OS: " + System.getProperty("os.name") + ' ' +
System.getProperty("os.arch") + ' ' + System.getProperty("os.arch") + ' ' +
@ -302,12 +304,17 @@ public class RouterConsoleRunner implements RouterApp {
log.logAlways(net.i2p.util.Log.WARN, s); log.logAlways(net.i2p.util.Log.WARN, s);
System.out.println("Warning: " + s); System.out.println("Warning: " + s);
if (noJava7) { if (noJava7) {
s = "Java 7 will be required by late 2015, please upgrade soon"; s = "Java 7 is now required, please upgrade";
log.logAlways(net.i2p.util.Log.WARN, s); log.logAlways(net.i2p.util.Log.WARN, s);
System.out.println("Warning: " + s); System.out.println("Warning: " + s);
} }
if (noPack200) { if (noPack200) {
s = "Pack200 will be required by late 2015, please upgrade Java soon"; s = "Pack200 is required for plugins and automatic updates, please upgrade Java";
log.logAlways(net.i2p.util.Log.WARN, s);
System.out.println("Warning: " + s);
}
if (openARM) {
s = "OpenJDK is not recommended for ARM. Use Oracle Java 8";
log.logAlways(net.i2p.util.Log.WARN, s); log.logAlways(net.i2p.util.Log.WARN, s);
System.out.println("Warning: " + s); System.out.println("Warning: " + s);
} }

View File

@ -37,7 +37,7 @@ public class CommandLine {
"net.i2p.util.PartialEepGet", "net.i2p.util.PartialEepGet",
"net.i2p.util.ShellCommand", "net.i2p.util.ShellCommand",
"net.i2p.util.SSLEepGet", "net.i2p.util.SSLEepGet",
//"net.i2p.util.SystemVersion", "net.i2p.util.SystemVersion",
"net.i2p.util.TranslateReader", "net.i2p.util.TranslateReader",
"net.i2p.util.ZipFileComment" "net.i2p.util.ZipFileComment"
}); });

View File

@ -26,6 +26,7 @@ public abstract class SystemVersion {
private static final boolean _isAndroid; private static final boolean _isAndroid;
private static final boolean _isApache; private static final boolean _isApache;
private static final boolean _isGNU; private static final boolean _isGNU;
private static final boolean _isOpenJDK;
private static final boolean _is64; private static final boolean _is64;
private static final boolean _hasWrapper = System.getProperty("wrapper.version") != null; private static final boolean _hasWrapper = System.getProperty("wrapper.version") != null;
@ -53,6 +54,8 @@ public abstract class SystemVersion {
_isApache = vendor.startsWith("Apache"); _isApache = vendor.startsWith("Apache");
_isGNU = vendor.startsWith("GNU Classpath") || // JamVM _isGNU = vendor.startsWith("GNU Classpath") || // JamVM
vendor.startsWith("Free Software Foundation"); // gij vendor.startsWith("Free Software Foundation"); // gij
String runtime = System.getProperty("java.runtime.name");
_isOpenJDK = runtime != null && runtime.contains("OpenJDK");
int sdk = 0; int sdk = 0;
if (_isAndroid) { if (_isAndroid) {
@ -110,6 +113,13 @@ public abstract class SystemVersion {
return _isGentoo; return _isGentoo;
} }
/**
* @since 0.9.26
*/
public static boolean isOpenJDK() {
return _isOpenJDK;
}
/** /**
* @since 0.9.8 * @since 0.9.8
*/ */
@ -238,7 +248,6 @@ public abstract class SystemVersion {
/** /**
* @since 0.9.24 * @since 0.9.24
*/ */
/****
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("64 bit : " + is64Bit()); System.out.println("64 bit : " + is64Bit());
System.out.println("Java 6 : " + isJava6()); System.out.println("Java 6 : " + isJava6());
@ -253,11 +262,11 @@ public abstract class SystemVersion {
System.out.println("Mac : " + isMac()); System.out.println("Mac : " + isMac());
System.out.println("Gentoo : " + isGentoo()); System.out.println("Gentoo : " + isGentoo());
System.out.println("GNU : " + isGNU()); System.out.println("GNU : " + isGNU());
System.out.println("OpenJDK : " + isOpenJDK());
System.out.println("Windows : " + isWindows()); System.out.println("Windows : " + isWindows());
System.out.println("Wrapper : " + hasWrapper()); System.out.println("Wrapper : " + hasWrapper());
System.out.println("x86 : " + isX86()); System.out.println("x86 : " + isX86());
System.out.println("Max mem : " + getMaxMemory()); System.out.println("Max mem : " + getMaxMemory());
} }
****/
} }