How can I prevent Ask.com Toolbar from being installed every time Java is updated?

UPDATE 2016-02-21: It seems that the old registry key below is not used anymore to disable sponsors. Since Java 7u65 and 8u11 (8u40 on Mac OS X) there is a supported way to disable sponsor offers directly through the Java Control Panel. In Windows:

Control Panel → Java → Advanced → Miscellaneous (scroll to bottom) →Suppress sponsor offers when installing or updating Java

Since 7u55 (8u40 on Mac OS X) you can also disable sponsor offers through the command line running a Java installer with a special argument:

jre-7u55-windows-i586-iftw.exe SPONSORS=0

For those of you that still need to disable sponsors in a programmatic way, it seems that now it's enough to add the following line to C:\ProgramData\Oracle\Java\java.settings.cfg (create a new file if it doesn't exist).

SPONSORS=0

Please note that this last method is undocumented and unsupported, just like the old one!


UPDATE 2016-02-21: The following one is the old method to disable sponsors, it only works for Java versions below 7u65. For newer Java versions see above. Digging a bit into the problem myself, I've found that there's an hidden switch to disable sponsor offers in the auto-update installer.

Open the following keys into the Windows Registry Editor (regedit.exe):

  • HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft (available only on Windows 64-bit)

and create in both of them a new String Value (type REG_SZ) named SPONSORS of value DISABLE (both name and value must be uppercase).

Alternatively, copy and paste the following code into a text file called disable_java_sponsors.reg and double click on it to import these values in your Registry.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]
"SPONSORS"="DISABLE"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft]
"SPONSORS"="DISABLE"

Please note that this switch not only disables the Ask.com toolbar installation and prompt, but disables all of the sponsors potentially bundled with the Auto-update setup/Online setup (Google toolbar, Yahoo toolbar, McAfee something, etc...)


Another way, without having to download and rename or create a new .REG file, is to copy and paste the following two lines into an elevated CMD prompt:

reg add HKLM\SOFTWARE\JavaSoft /v "SPONSORS" /t REG_SZ /d "DISABLE" /f 
reg add HKLM\SOFTWARE\Wow6432Node\JavaSoft /v "SPONSORS" /t REG_SZ /d "DISABLE" /f

Edit 2014-02-02: With JavaRE 7u51, Ask toolbar now installs into a subfolder named "AskPartnerNetwork" instead of "Ask.com". One could have suspicions about what the point of that is... Meanwhile, @Danilo Roascio's registry values are still obeyed and works just as well as before.

This just highlights that the simple registry fix, is still the simplest and best solution. In case the Java installer changes, so that this registry value is ignored, the following script can still be used as a workaround - just make sure the Ask Toolbar path is updated.


The simplest way to prevent Ask Toolbar from being installed again I could think of, was to create the folder Ask Toolbar installs into and modify the permissions, so no one can write to it.

First, make sure that the Ask Toolbar has been removed. Then copy the following code to Notepad, save it as a .cmd file and run it in an elevated command prompt:

REM Detect processor architecture
set proc_arch=x64
if "%PROCESSOR_ARCHITECTURE%" == "x86" ( 
    if not defined PROCESSOR_ARCHITEW6432 set proc_arch=x86
) 

REM Define Ask Toolbar path
if "%proc_arch%" == "x86" set AskPath=%ProgramFiles%\Ask.com
if "%proc_arch%" == "x64" set AskPath=%ProgramFiles(x86)%\Ask.com
set AskReadme=%AskPath%\..\Ask.com_ReadMe.txt
set AskRevert=%AskPath%\..\Ask.com_RestorePermissions.cmd

REM Create dummy Ask Toolbar folder
md "%AskPath%"

REM Add explanatory text file, as to why the dummy folder is there
echo The 'Ask.com' folder is has been created and write protected,> "%AskReadme%"
echo in order to prevent Ask.com Toolbar from being 'accidentally'>> "%AskReadme%"
echo installed, e.g. by Java.>> "%AskPath%\readme.txt">> "%AskReadme%"
echo.>> "%AskReadme%"
echo This has been done using ICACLS by denying write access to the>> "%AskReadme%"
echo EVERYONE security group.>> "%AskReadme%"
echo.>> "%AskReadme%"
echo To revert permissions run:>> "%AskReadme%"
echo %AskRevert%>> "%AskReadme%"

REM Create script to remove restrictions
echo icacls "%AskPath%" /remove:d *S-1-1-0> "%AskRevert%"

REM Deny everyone (SID: S-1-1-0) write access
icacls "%AskPath%" /deny *S-1-1-0:(OI)(CI)W

Please note: ICACLS is included in Windows Vista and later. You can download ICACLS for Windows XP/Server 2003 through Microsoft KB919240, or an updated version through KB943043 (but the latter must first be requested, after which you will receive a link by e-mail to download it). For this purpose, both versions should work equally well.

I have verified with the installer for Java 1.7 update 13, that the Ask Toolbar indeed does not install, even if I leave the checkbox checked.

A similar approach can most likely be used to block most other kinds of piggybacking crapware.

Edit #1

Windows Explorer quirk: Access denied

Windows Explorer behaves a little strange if you try to open the folder. Even though you still have read access to the folder, Windows Explorer will tell you that access is denied, even though only write access has been denied.

This doesn't happen if you simply only have been assigned read access in the first place, but it seems to happen when you have been assigned read/write permission to the folder and then been denied write access.

Reverting permissions

The script has been updated to add a 'read me' text file and a script for removing the restriction again. Both are stored in the 32-bit program files folder.


Consider using https://ninite.com/ Select all the apps you want it to install/update, and with a single click it'll install only those apps, w/o extra garbage like Ask toolbar in java. If a system already has the latest version of a given app, Ninite will skip that install. Also you don't need to regenerate its package every time. The same .exe will ensure that you always install the latest versions. Just tell your friends/family to run it once a month and it'll make sure they are always up to date.

Update: Alternatively, if you install JRE from http://www.oracle.com/technetwork/java/javase/downloads/index.html it does not come with Ask or McAfee toolbars. (Not sure about auto-update afterwards).