diff --git a/src/java/org/lwjgl/util/applet/AppletLoader.java b/src/java/org/lwjgl/util/applet/AppletLoader.java
index c4c586ed..1a2a0e08 100644
--- a/src/java/org/lwjgl/util/applet/AppletLoader.java
+++ b/src/java/org/lwjgl/util/applet/AppletLoader.java
@@ -98,7 +98,7 @@ import java.util.zip.ZipFile;
* The following applet parameters are required:
*
* - al_main - [String] Full package and class the applet to instantiate and display when loaded.
- * - al_jars - [String] Comma seperated list of jars to download.
+ * - al_jars - [String] Comma separated list of jars to download.
*
*
- al_windows - [String] Jar containing native files for windows.
* - al_linux - [String] Jar containing native files for linux.
@@ -110,19 +110,21 @@ import java.util.zip.ZipFile;
*
* Additionally the following parameters can be supplied to tweak the behaviour of the AppletLoader.
*
+ * - al_cache - [boolean] Whether to use cache system. Default: true.
* - al_version - [int or float] Version of deployment. If this is specified, the jars will be cached and
* reused if the version matches. If version doesn't match all of the files are reloaded.
- * - al_cache - [boolean] Whether to use cache system. Default: true.
+ *
* - al_debug - [boolean] Whether to enable debug mode. Default: false.
- * - al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multple domains and needs to share the cache. Default: true.
+ * - al_min_jre - [String] Specify the minimum jre version that the applet requires, should be in format like 1.6.0_24 or a subset like 1.6 Default: 1.5.
+ * - al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multiple domains and needs to share the cache. Default: true.
*
*
- al_windows64 - [String] If specified it will be used instead of al_windows on 64bit windows systems.
- * - al_windows32 - [String] If specifed it will be used instead of al_windows on 32bit windows systems.
- * - al_linux64 - [String] If specifed it will be used instead of al_linux on 64bit linux systems.
- * - al_linux32 - [String] If specifed it will be used instead of al_linux on 32bit linux systems.
- * - al_mac32 - [String] If specifed it will be used instead of al_mac on 64bit mac systems.
- * - al_mac64 - [String] If specifed it will be used instead of al_mac on 32bit mac systems.
- * - al_macppc - [String] If specifed it will be used instead of al_mac on PPC mac systems.
+ * - al_windows32 - [String] If specified it will be used instead of al_windows on 32bit windows systems.
+ * - al_linux64 - [String] If specified it will be used instead of al_linux on 64bit linux systems.
+ * - al_linux32 - [String] If specified it will be used instead of al_linux on 32bit linux systems.
+ * - al_mac32 - [String] If specified it will be used instead of al_mac on 64bit mac systems.
+ * - al_mac64 - [String] If specified it will be used instead of al_mac on 32bit mac systems.
+ * - al_macppc - [String] If specified it will be used instead of al_mac on PPC mac systems.
*
*
- boxbgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as background. Default: #ffffff.
* - boxfgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as foreground. Default: #000000.
@@ -144,7 +146,6 @@ import java.util.zip.ZipFile;
* - Bobjob
* - Dashiva
* - Dr_evil
- * - Elias Naur
* - Kevin Glass
* - Matthias Mann
* - Mickelukas
@@ -160,36 +161,39 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
/** initializing */
public static final int STATE_INIT = 1;
+
+ /** checking version of jre */
+ public static final int STATE_CHECK_JRE_VERSION = 2;
/** determining which packages that are required */
- public static final int STATE_DETERMINING_PACKAGES = 2;
+ public static final int STATE_DETERMINING_PACKAGES = 3;
/** checking for already downloaded files */
- public static final int STATE_CHECKING_CACHE = 3;
+ public static final int STATE_CHECKING_CACHE = 4;
/** downloading packages */
- public static final int STATE_DOWNLOADING = 4;
+ public static final int STATE_DOWNLOADING = 5;
/** extracting packages */
- public static final int STATE_EXTRACTING_PACKAGES = 5;
+ public static final int STATE_EXTRACTING_PACKAGES = 6;
/** validating packages */
- public static final int STATE_VALIDATING_PACKAGES = 6;
+ public static final int STATE_VALIDATING_PACKAGES = 7;
/** updating the classpath */
- public static final int STATE_UPDATING_CLASSPATH = 7;
+ public static final int STATE_UPDATING_CLASSPATH = 8;
/** switching to real applet */
- public static final int STATE_SWITCHING_APPLET = 8;
+ public static final int STATE_SWITCHING_APPLET = 9;
/** initializing real applet */
- public static final int STATE_INITIALIZE_REAL_APPLET = 9;
+ public static final int STATE_INITIALIZE_REAL_APPLET = 10;
/** stating real applet */
- public static final int STATE_START_REAL_APPLET = 10;
+ public static final int STATE_START_REAL_APPLET = 11;
/** done */
- public static final int STATE_DONE = 11;
+ public static final int STATE_DONE = 12;
/** used to calculate length of progress bar */
protected int percentage;
@@ -239,9 +243,6 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
/** applet to load after all downloads are complete */
protected Applet lwjglApplet;
- /** whether a fatal error occured */
- protected boolean fatalError;
-
/** whether we're running in debug mode */
protected boolean debugMode;
@@ -280,19 +281,33 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
/** messages to be passed via liveconnect in headless mode */
protected String[] headlessMessage;
+
+ /** whether a fatal error occurred */
+ protected boolean fatalError;
+
+ /** whether a certificate refused error occurred */
+ protected boolean certificateRefused;
+
+ /** whether the minimum required JRE version is not found */
+ protected boolean minimumJreNotFound;
/** generic error message to display on error */
protected String[] genericErrorMessage = { "An error occured while loading the applet.",
"Please contact support to resolve this issue.",
""};
- /** whether a certificate refused error occured */
- protected boolean certificateRefused;
-
- /** error message to display if user refuses to accept certicate*/
+ /** error message to display if user refuses to accept certificate*/
protected String[] certificateRefusedMessage = { "Permissions for Applet Refused.",
"Please accept the permissions dialog to allow",
"the applet to continue the loading process."};
+
+ /** error message to display if minimum JRE version is not met */
+ protected String[] minimumJREMessage = { "Your version of Java is out of date.",
+ "Visit java.com to get the latest version.",
+ "Java or greater is required."};
+
+ /** fatal error message to display */
+ protected String[] errorMessage;
/** have natives been loaded by another instance of this applet */
protected static boolean natives_loaded;
@@ -439,6 +454,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
* This method will return the current progress of the AppletLoader
* as a value from 0-100. In the case of a fatal error it will
* return -1. If the certificate is refused it will return -2.
+ * If the minimum jre requirement is not met will return -3.
*
* When method returns 100 the AppletLoader will sleep until the
* method is called again. When called again it will switch to the
@@ -447,8 +463,10 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
*/
public int getStatus() {
if (fatalError) {
+ headlessMessage = errorMessage;
+
if (certificateRefused) return -2;
- headlessMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage;
+ if (minimumJreNotFound) return -3;
return -1;
}
@@ -497,6 +515,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
cleanUp(); // clean up resources
return;
}
+
+ // no drawing in headless mode
+ if (headless) return;
// create offscreen if missing
if (offscreen == null) {
@@ -529,12 +550,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
og.fillRect(0, 0, offscreen.getWidth(null), offscreen.getHeight(null));
og.setColor(fgColor);
- String message = getDescriptionForState();
-
+
// if we had a failure of some sort, notify the user
if (fatalError) {
- String[] errorMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage;
-
for(int i=0; i();
// store file sizes and mark which files not to download
@@ -1285,7 +1362,6 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
* @throws Exception if download fails
*/
protected void downloadJars(String path) throws Exception {
-
setState(STATE_DOWNLOADING);
URLConnection urlconnection;
@@ -1980,13 +2056,25 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
}
/**
- * Sets the state of the loaded and prints some debug information
+ * Sets the error message and print debug information
*
* @param error Error message to print
*/
protected void fatalErrorOccured(String error, Exception e) {
fatalError = true;
- genericErrorMessage[genericErrorMessage.length-1] = error;
+
+ if (minimumJreNotFound) {
+ errorMessage = minimumJREMessage;
+ errorMessage[errorMessage.length-1] = error;
+ }
+ else if (certificateRefused) {
+ errorMessage = certificateRefusedMessage;
+ }
+ else {
+ errorMessage = genericErrorMessage;
+ errorMessage[errorMessage.length-1] = error;
+ }
+
System.out.println(error);
if(e != null) {
System.out.println(e.getMessage());