- externalize min jre version required

This commit is contained in:
Richard Alam 2014-07-18 08:45:10 -07:00
parent af3e7875ee
commit dfbf77aab0
2 changed files with 18 additions and 17 deletions

View File

@ -12,6 +12,7 @@ function startApplet(IP, roomNumber, fullScreen, useSVC2)
"<param name=\"SCALE\" value=\"0.8\"/>" +
"<param name=\"FULL_SCREEN\" value=\"" + fullScreen + "\"/>" +
"<param name=\"SVC2\" value=\"" + useSVC2 + "\"/>" +
"<param name=\"JavaVersion\" value=\"1.7.0_51\"/>" +
"<param name=\"permissions\" value=\"all-permissions\"/>" +
"</applet>"
);

View File

@ -25,8 +25,6 @@ import javax.swing.JOptionPane;
import java.io.IOException;
import java.net.URL;
import java.security.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.awt.Image;
public class DeskShareApplet extends JApplet implements ClientListener {
@ -34,7 +32,8 @@ public class DeskShareApplet extends JApplet implements ClientListener {
private static final long serialVersionUID = 1L;
String hostValue = "localhost";
String hostValue = "localhost";
String minJreVersion = "1.7.0_51";
Integer portValue = new Integer(9123);
String roomValue = "85115";
Integer cWidthValue = new Integer(800);
@ -54,23 +53,25 @@ public class DeskShareApplet extends JApplet implements ClientListener {
public boolean isSharing = false;
private volatile boolean clientStarted = false;
private static final String MIN_JRE_VERSION = "1.7.0_51";
private final static String VERSION_ERROR_MSG = "Desktop sharing requires Java 7 update 51 (or later) to run.";
private final static String VERSION_ERROR_MSG = "You have an unsupported Java version.";
private class DestroyJob implements PrivilegedExceptionAction {
public Object run() throws Exception {
System.out.println("Desktop Sharing Applet Destroy");
if (clientStarted) {
client.stop();
}
return null;
System.out.println("Desktop Sharing Applet Destroy");
if (clientStarted) {
client.stop();
}
return null;
}
}
@Override
public void init() {
System.out.println("Desktop Sharing Applet Initializing");
System.out.println("Desktop Sharing Applet Initializing");
String javaVersion = getParameter("JavaVersion");
if (javaVersion != null && javaVersion != "") minJreVersion = javaVersion;
hostValue = getParameter("IP");
String port = getParameter("PORT");
if (port != null) portValue = Integer.parseInt(port);
@ -126,14 +127,13 @@ public class DeskShareApplet extends JApplet implements ClientListener {
public void start() {
System.out.println("Desktop Sharing Applet Starting");
super.start();
String javaRuntimeVersion = getJavaVersionRuntime();
System.out.println("**** JAVA VERSION = [" + javaRuntimeVersion + "]");
System.out.println("**** JAVA VERSION = [" + getJavaVersionRuntime() + "]");
System.out.println("Validate min JRE version");
if(VersionCheckUtil.validateMinJREVersion(getJavaVersionRuntime(), MIN_JRE_VERSION))
if (VersionCheckUtil.validateMinJREVersion(javaRuntimeVersion, minJreVersion))
allowDesktopSharing();
else
displayJavaWarning(VERSION_ERROR_MSG);
displayJavaWarning("Unsupported Java version [" + javaRuntimeVersion + "]. Minimum version required [" + minJreVersion + "]");
}