Monday, May 30, 2011

Java Control Panel Icon "Application Not Found"

Howto: Fix the "Application not found" error in the Java Control Panel icon. These same steps may be useful for other malfunctioning Windows Control Panel icons.
 
In Windows 7, the Java Control Panel icon may be damaged / corrupted. Attempting to launch the icon results in "Explorer.exe : Application not found". Note the generic icon:


When working properly, the circled icon should look like this:



This problem appears to be an artifact from previous JRE installations and Sun's installation routines were flawed.


Re-installing JRE (the Java Runtime Environment) does not resolve the problem.


Immediate workaround:

If needed, the Java Control Panel can be launched manually, even if the control panel icon is missing or corrupt:

C:\Program Files (x86)\Java\JRE6\bin\Javacpl.exe

As a side note, when launching the javacpl in this fashion, other-mouse-click the .exe and choose "Run as Administrator".  Running as Administrator resolves a bug where changes in the Control Panel (especially Auto-update changes) do not stick. This is true even when the icon is working properly. Sun/Java is aware of this issue.


Permanent Solution:

To fix this problem, you need to know the name of the executable that drives the Java Control Panel.  Unfortunately, control panel icons often hide the name of the actual program.  Follow these steps to determine the .exe's underlying name.

If you already know the name of the executable, from above, skip to step 1.
(e.g. Program Files (x86)\Java\JRE6\bin\Javacpl.exe)



A. Determine the name of the program. 

In the Control Panel,"Other-mouse-click" (right click) the failed icon
Click "Create Shortcut".
The shortcut will be placed on the desktop, with no message or other prompts.

B. Locate the new Desktop icon.


"Other-mouse-click"
Choose "Properties"

Note: In this case, the Java Control Panel icon's name will be similar to 'Control Panel\All Control Panel Items\Java' -- which is not the actual executable's name and is not very useful. Most Control Panel icons will not display the target-path and the true name is hidden in the registry.  Continue with the remaining steps in order to find the name. 

C. Discover the actual path by clicking "Change Icon".

If the underlying executable is corrupted or missing, the displayed error message will show the actual path. For example, the Java Control Panel reports "Windows can't find the file C:\Program Files\Java\JRE6\bin\javacpl.exe".

Note the path and filename.
Use this to find the registry value in the next step.


Removing the Control Panel Icon:

Assuming you know the path to the Control Panel's icon (see steps above), use Regedit to fix the malfunctioning key. As always, exercise care when editing the registry:

1. Launch the Windows Registry Editor with a Start, Run, "Regedit.exe"

See this article for how to expose the Windows 7 Run command.

2. Position the cursor at the top of the Registry tree.

3. Type Ctrl-F (find) and search for the executable's name.  Important, when searching, use a partial path, not the full name.

For example, the actual (fully-qualified path name is :
C:\Program Files\Java\JRE6\bin\javacpl.exe).

In this case, search for this partial string:
"\bin\javacpl.exe" (no quotes)

Searching for a partial string avoids problems with 'Program Files (x86)' vs "Program Files" or 'JRE5', etc..

4. Expected Find Results:

For the Java Control Panel, expect to find this registry key GUID:

HKEY_Classes_Root\CLSID\{4299124F-F2C3-41b4-9C73-9236B2AD0E8F}

Be sure this key is within "HKEY_Classes_Root\CSLID" and not in another location in the registry. 
Confirm by opening the key; you will see javacpl.exe lurking within.

5. Delete the top-folder {4299124f...E8F} and all items within.

Do not delete the CSLID folder.
Close Regedit.

If the "MuiCache" or "Wow6432Node" key is found, you overshot the CSLID key. Confirm you started the search at the top of the tree. If you still cannot find the key, do not continue with the rest of this article.


Test the results:

Close and re-open the Windows Control Panel.

The 'generic' Java icon should be replaced with a properly-formed Java icon and the control panel icon should behave properly.




If the control panel still mis-behaves, consider re-installing the JRE or see the registry-merge below.


The Correct Registry Key:

The above steps should resolve the conflict and no further action is required.
For documentation, here is the correct key (with JRE6).   You can run this registry merge by hand, bypassing the steps above.  Note the registry-merge uses the same GUID key and it overwrites (does not delete and re-install) the key.  

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4299124F-F2C3-41b4-9C73-9236B2AD0E8F}]
@="Java"
"System.ControlPanel.Category"="8"
"InfoTip"="@C:\\Program Files (x86)\\Java\\jre6\\bin\\javacpl.exe,-2"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4299124F-F2C3-41b4-9C73-9236B2AD0E8F}\DefaultIcon]
@="C:\\Program Files (x86)\\Java\\jre6\\bin\\javacpl.exe"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4299124F-F2C3-41b4-9C73-9236B2AD0E8F}\Shell]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4299124F-F2C3-41b4-9C73-9236B2AD0E8F}\Shell\Open]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4299124F-F2C3-41b4-9C73-9236B2AD0E8F}\Shell\Open\Command]
@="C:\\Program Files (x86)\\Java\\jre6\\bin\\javacpl.exe"



Re-Installing Java:
This article is not recommending a re-install of Java to fix this problem (the author found it did not help), but from reader comments below, many have attempted to re-install.  Be aware if you do, be sure to install the 32-bit version of Java -- even if you have a 64-bit operating system.

Reader Ronald Arnold, Germany, reported installing the 64-bit version of JRE, followed by the 32-bit version caused this problem.  I am sure he is correct, but in my case, I have never installed the 64-bit JRE -- I suspect there are multiple causes for this control-panel icon problem.


Other Control Panel Icons:

If you are searching for other non-Java Control Panel icon problems, this registry key may be of interest:

HKLM\Software\Microsoft\Windows\CurrentVersion\Control Panel\CPLs.

Be aware the Java Control Panel does not live in this location. Only a few system control panels live here but I could imagine other vendors sticking something in here.

Your unregistered comments on this article are welcome.

Related articles:
Streamline Windows 7 Start Menus
Turn off UAC Nags on Start Menu Items
Recommended Win7 Explorer Changes

Related Links:
I have not used this utility, but in the event of a complete java failure, this link may be of interest:  Completely uninstall all Java using a beta product called JavaRA:


Keywords:
Java control panel, java.cpl, javacpl.exe, JRE