Is there a way to change a default program by java, cmd or regedit?

Asked

Viewed 2,246 times

1

I am developing a java system, but from it I should change the default program to open . pdf in the switch. In Windows 10 it opens by default in Edge, but from the system it should change to Adobe.

I’ve tried the cmd with the Assoc command (restarting the computer later):

assoc .pdf=AcrodRd32.exe

or

assoc .pdf=AcroExch.Document.DC

I have also tried using regedit with the script (also restarting the computer later):

===================
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.pdf]
@=".pdf=AcroExch.Document.DC"
"Content Type"="application/pdf"

[HKEY_CLASSES_ROOT\.pdf\OpenWithList]

[HKEY_CLASSES_ROOT\.pdf\OpenWithList\AcrodRd32.exe]
@=""
===================

I tested the script in HKEY_CLASSES_ROOT.pdf as in HKEY_CLASSES_USER Software Microsoft Windows Currentversion Explorer Fileexts but none worked.

I believe that straight through java has no way to change. Does anyone have any idea how to make this change ?

1 answer

1


This site shows something not very encouraging.

It seems that since Windows 10, this functionality has been removed:

"We know that standard programs are important to you. In Windows 10, all applications - both Classic and Universal - will not be able to show a window asking if you want to change your default program - only Windows." - English

Maybe by making a classic application (I don’t know exactly if it just means compiling for older systems or not) you can still take advantage of this prompt:

prompt ensinando o usuário a mudar o programa padrão

But anyway it will only "teach" the user to change the default program and not "offer" to exchange automatically.

Even so, in Java this is not possible without some "gambiarras", because . jar is not a valid Windows application. A possible solution is to turn . jar into . exe - that program not only creates an executable of a . jar but also says set the default program.

But I guess we’re out of luck!

Sources on the Soen:
Set default program for Extension after msi installation
Use the Java application as the Default Program for a particular file type?

  • Yeah, we’re out of luck anyway. Really all I tried was on Windows 10, but nothing worked. I will try in previous versions, but all the computers here in the company are Windows 10 so it will not solve. Thanks anyway!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.