Finally, we include the -XdockSet flag as the first argument passed to our jar file.Īny arguments that were passed initially to the jar file must then be appended to the launch commands so they are not lost when we relaunch our application. This then is included in the Java launch command string. The call to exportResource() extracts a resource from the executable jar to the folder where the jar is located and returns the path of the extracted resource, in this case our application's icon. If however, you want to display your application's icon in the dock it will be necessary to export the resource from the jar so that it might be read by the Java runtime during relaunch. As a result, the Dock will display the default Java coffee cup. If a null is supplied to the applicationIcon argument, then the Java launch command string will not include the -Xdock:icon= argument and parameter. In order to have some flexibility setting the dock icon is optional. Don't use this as an argument for your app if you use this class.) and so execution proceeds to the first half of the method where the relaunch command is built and executed. The first time this method is called, the flag -XdockSet will not be found ( rather should not be found. Checking for this flag is therefore the first step in the process. This is achieved by means of a flag prepended to the jar file argument list upon completion of the first half of the method code. While looking at this code the first thing to note is that this method behaves as if it were a recursive method, and while it doesn't call itself directly, it performs a kind of inter-process recursion and as such needs a stop condition. Static protected void setMacMenuAboutNameAndDockIcon( final String applicationArgs,įinal String applicationName, final String applicationIcon)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |