You can write the / powershell script package and include it along with the font files in your application. Then you can execute the script with
Runtime.getRuntime().exec(...)
Most likely, you will need to increase privileges for your application after its launch.
As for the password transfer. You can run cmd.exe
so that it pops up and prompts the user. You can also try assigning the return value of exec to an object of the Process
class that has the InputStream
and OutputStream
. I am not sure how to do this. I did this once in a project, a couple of years ago, but I no longer have code.
If you only need to install fonts once, consider creating an installer for your Java application that takes care of this. There is a neat installation generator called IzPack, which allows you to create complex installers using XML. It also allows you to elevate privileges for executable files that are executed during installation. So I do such things.
source share