--- jvmfwk/inc/jvmfwk/framework.h.old	2007-06-13 09:56:54.000000000 +0200
+++ jvmfwk/inc/jvmfwk/framework.h	2007-10-30 21:17:59.000000000 +0100
@@ -236,7 +236,8 @@ typedef enum _javaFrameworkError
     JFW_E_NO_JAVA_FOUND,
     JFW_E_VM_CREATION_FAILED,
     JFW_E_CONFIGURATION,
-    JFW_E_DIRECT_MODE
+    JFW_E_DIRECT_MODE,
+    JFW_E_TRY_AUTOSELECT
 } javaFrameworkError;
 
 /** an instance of this struct represents an installation of a Java
@@ -541,9 +542,11 @@ javaFrameworkError SAL_CALL jfw_getJavaI
     then the user enabled it. If then the selected  JRE has the requirement
     JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
     JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
-    by a plug-in library and not by this API.
+    by a plug-in library and not by this API.</br>
     JFW_E_FAILED_VERSION the &quot;Default Mode&quot; is active. The JRE determined by
-    <code>JAVA_HOME</code>does not meet the version requirements.
+    <code>JAVA_HOME</code>does not meet the version requirements.</br>
+    JFW_E_TRY_AUTOSELECT the current setting is wrong but autoselection
+    is enabled. Let's try it if possible.
  */
 javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions,
                                  sal_Int32 nSize, JavaVM **ppVM,
@@ -573,7 +576,9 @@ javaFrameworkError SAL_CALL jfw_startVM(
     JFW_E_ERROR An error occurred.<br/>
     JFW_E_CONFIGURATION mode was not properly set or their prerequisites
     were not met.<br/>
-    JFW_E_DIRECT_MODE the function cannot be used in this mode.
+    JFW_E_DIRECT_MODE the function cannot be used in this mode.<br/>
+    JFW_E_TRY_AUTOSELECT the current setting is wrong but autoselection
+    is enabled. Let's try it if possible.
  */
 javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo);
 
@@ -603,7 +608,9 @@ javaFrameworkError SAL_CALL jfw_setSelec
     JFW_E_CONFIGURATION mode was not properly set or their prerequisites
     were not met.<br/>
     JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
-    JRE has been selected afterwards. <br/>
+    JRE has been selected afterwards.<br/>
+    JFW_E_TRY_AUTOSELECT the current setting is wrong but autoselection
+    is enabled. Let's try it if possible.
  */
 javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo);
 
--- jvmfwk/source/framework.cxx.old	2007-06-13 09:57:42.000000000 +0200
+++ jvmfwk/source/framework.cxx	2007-10-30 21:01:57.000000000 +0100
@@ -711,11 +711,26 @@ javaFrameworkError SAL_CALL jfw_getSelec
 			*ppInfo = NULL;
 			return JFW_E_NONE;
 		}
+
+		// If the java location does not longer exist, ignore this aInfo
+		rtl::OUString sLocation = aInfo.getLocation();
+		if (jfw::checkFileURL(sLocation) != jfw::FILE_OK)
+	        {
+		    bool bAutoSelect = settings.getJavaInfoAttrAutoSelect();
+		    jfw_freeJavaInfo(aInfo.detach());
+		    *ppInfo = NULL;
+
+		    if (bAutoSelect)
+			    return JFW_E_TRY_AUTOSELECT;
+		    else
+			    return JFW_E_CONFIGURATION;
+		}
+
 		//If the javavendors.xml has changed, then the current selected
 		//Java is not valid anymore
 		// /java/javaInfo/@vendorUpdate != javaSelection/updated (javavendors.xml)
 		rtl::OString sUpdated = jfw::getElementUpdated();
-	    
+
 		if (sUpdated.equals(settings.getJavaInfoAttrVendorUpdate()) == sal_False)
 			return JFW_E_INVALID_SETTINGS;
 		*ppInfo = aInfo.detach();
--- jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx.old	2006-09-16 19:45:14.000000000 +0200
+++ jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx	2007-10-30 21:04:14.000000000 +0100
@@ -104,7 +104,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         fprintf(stderr,"javaldx failed. User must select a JRE from options dialog!");
         return -1;
     }
-    else if (errcode != JFW_E_NONE)
+    else if (errcode != JFW_E_NONE && errcode != JFW_E_TRY_AUTOSELECT)
     {
         fprintf(stderr,"javaldx failed! \n");
         return -1;
