简体   繁体   中英

Wrapping an executable jar file with an icon

Background: I created a simple GUI in java and can run that GUI by clicking its executable jar file. I created the GUI in java so that it could be ran on more than one OS.

Question: Is there a way to make some sort of "wrapper icon" for the jar file so that when I click it (the icon) the GUI opens up?

To be clear I am not talking about changing the .jar file icon, that is determined by the OS. I successfully converted the jar file to a .exe, .app and .sh file with the intent of running a cmd file that would determine the OS and run the appropriate file. But then I started feeling like I was backtracking. I know I am being picky but I just thought I would be useful for my Java programs to have different icons. Any ideas?

I created a simple GUI .. Is there a way to make some sort of "wrapper icon" for the.. (GUI)

Sure. Launch the app. using Java Web Start . It can install desktop icons and menu shortcuts with icons on supported platforms. For further branding, add a splash.

Windows: Launch4J creates an EXE from you JAR and lets you choose its icon. If you want to keep whatever tool you are currently using for building the EXE and then go and change the icon of that EXE, try Resource Hacker: http://download.cnet.com/Resource-Hacker/3000-2352_4-10178587.html

Mac:
For changing the Mac app bundle icon, add the following in your info.plist

<key>CFBundleIconFile</key>
<string>maciconfile</string>

having put a maciconfile.icns file in your Resources directory.

Xcode Developer Tools which you can get for free if you own a Mac have the tools you need. If you do not have a Mac, there are tools on other platfroms that allow you to build bundles for Mac (such as the OS X Application Bundle Plugin for Maven).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM