At length: When Apple developed the Java SDK for macosx, you could open a .app mac-style application bundle written in Java by doubleclicking its icon in Finder, its app icon will show up in your dock while it was running, and its menu items would live in the Mac OS menu bar. Java apps behaved almost like native Mac apps.
On the other hand, if you install the current Java SDK from Oracle, you can execute your Java application with java -jar YourApp.app/Contents/Resources/Java/yourapp.jar, but you get a generic dock icon, your menu items live on top of the window instead of menu bar.
At the questions Run java bundled in .app from command-line and Why is Java SE 6 Legacy required to open Intellij?, it is suggested that you can force your Java .app bundle to use a newer version of Java if you change the JVMVersion in YourApp.app/Contents/Info.plist, but this did not work for me. Those answers are from Java 1.7 era, maybe it's outdated?
From replies to a question I asked on Apple's java-dev list it would appear that on a Mac with Java 8 from Oracle installed, but not Java 6 from Apple, there is no current way to open a Java application bundle that was created using Apple's own old jar bundler technology. I suspect this is because the JavaApplicationStub is written to expect some aspect of Apple's Java not present in Oracle's Java.
Max builds universal binary standalone applications on the Mac. The standalone is an application package , which is also a folder that looks like a file in the Finder. Double-clicking on the file's icon launches the application.
I've put together a small class that makes it trivially easy to ensure that a Java application name appears in the Mac menu bar and it's icon appears in the dock. Just add the class to your project and use it as follows:
In order to have some flexibility; setting the dock icon is optional. If a null is supplied to the applicationIcon argument, then the Java launch command string will not include the -Xdock:icon= argument and parameter. As a result, the Dock will display the default Java coffee cup. 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. 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. This then is included in the Java launch command string. Finally, we include the -XdockSet flag as the first argument passed to our jar file.
The second time this method is called, the flag -XdockSet will be found and so execution moves to the second half of the method where cleanup takes place. In this case, I wanted to remove the temporary icon resource that was copied out of the jar after it had been loaded into the Dock by the JVM. The comments in the code explain the necessity of invoking the call to File.delete() after the method completes.
You can determine which version of the JDK is the default by entering java -version in a Terminal window. If the installed version is 10 Interim 0, Update 2, and Patch 1, then you see a string that includes the text 10.0.2.1. For example:
Some applications use /usr/bin/java to call Java. After installing Java for macOS 2012-006, /usr/bin/java will find the newest JDK installed, and will use that for all of the Java-related command-line tools in /usr/bin. You may need to modify those applications to find Java 6, or contact the developer for a newer version of the application.
Our Java Web Start app icon on the desktop shortcut is the default Java coffee cup icon on Mac OS X 10.7 or later using Oracle Java 7 or later. On the Apple provided Java 6 the desktop shortcut icons worked. We've tried changing the icon file type and other settings we can find on the web for the JNLP file but we're not finding other people talking about this so maybe we're just doing it wrong. The trouble is, we don't seem to have the right search terms to find out how to fix it or if it's working or not for others. One interesting thing we've noticed is that if we make a second shortcut to the app, the shortcut has the right icon. Also if we go to Get Information for the web start app and on the General tab click Locked our icon appears. Finally, the App folder/bundle created by Java shows the right icon. It is just the desktop shortcut it creates that isn't working.
Launch4j is a cross-platform tool for wrapping Java applications distributed as jars in lightweight Windows native executables. The executable can be configured to search for a certain JRE version or use a bundled one, and it's possible to set runtime options, like the initial/max heap size. The wrapper also provides better user experience through an application icon, a native pre-JRE splash screen, and a Java download page in case the appropriate JRE cannot be found.
The following program create and write to a text file "out.txt" (via java.util.Formatter), and read it back (via java.util.Scanner). I do the write first so that you can check the location of the exteranl files under eclipse, which is at the project base directory, at the same level as the "src" and "bin".
Older OSX releases include Java 5, this version does not support Tray icon, and DavMail uses a dedicated frame instead. An upgrade to Java 6 will enable tray icon. Recent OSX versions either include Java 6 or can install it automatically on first Java application launch. Note that Java 7 is only available from Oracle and will not be provided by Apple.
If you use the External Image option in the icon property editor, the IDE will generate an absolute path to the image instead of copying the image to your project. Therefore, the image would appear when you run the application on your system, but it would probably not appear when running the application on another system.
In order to change the icon of the executable application file itself, as it is presented on the desktop (that is, prior to application launch), it is necessary to employ another, platform-dependent technique.
To configure your application's icon, a resource file containing information about the icon is required. A resource file is a text file that contains information about the application resources, such as icons, cursors, fonts, and so on. For more information about resource files and what it can contain, see About Resource Files.
The application icon, typically displayed in the application dock area, is set by calling QWindow::setWindowIcon() on a window. It is possible that the program could appear in the application dock area before the function call, in which case a default icon will appear during the bouncing animation.
Although many programs can create icon files (.icns), the recommended approach is to use the iconutil program supplied by Apple. iconutil is a command-line tool that converts iconset folders to deployment-ready, high-resolution icns files. Using this tool also compresses the resulting icns file, so there is no need for you to perform additional compression.
To configure the application's icon, the Info.plist file generated by CMake must contain the icon information. This can be achieved by setting the .icns file name to the MACOSX_BUNDLE_ICON_FILE variable.
Notice that the first set command defines the MACOSX_BUNDLE_ICON_FILE variable, which is required to add the icon file to the Info.plist file. The second set command defines the app_icon_macos variable with the absolute path to the icon file. This variable is then used to configure MACOSX_PACKAGE_LOCATION, which defines the icon file's install location. Finally, the add_executable uses the app_icon_macOS variable to set the application's icon.
If you are still using qmake to generate your makefiles, you only need to add a single line to your .pro project file. For example, if the name of your icon file is myapp.icns, and your project file is myapp.pro, add this line to myapp.pro:
In this section we briefly describe the issues involved in providing icons for applications for two common Linux desktop environments: KDE and GNOME. The core technology used to describe application icons is the same for both desktops, and may also apply to others, but there are details which are specific to each. The main source of information on the standards used by these Linux desktops is freedesktop.org. For information on other Linux desktops please refer to the documentation for the desktops you are interested in.
Often, users do not use executable files directly, but instead launch applications by clicking icons on the desktop. These icons are representations of "desktop entry files" that contain a description of the application that includes information about its icon. Both desktop environments are able to retrieve the information in these files, and they use it to generate shortcuts to applications on the desktop, in the start menu, and on the panel.
Although desktop entry files can usefully encapsulate the application's details, we still need to store the icons in the conventional location for each desktop environment. A number of locations for icons are given in the Icon Theme Specification.
Although the path used to locate icons depends on the desktop in use, and on its configuration, the directory structure beneath each of these should follow the same pattern: subdirectories are arranged by theme, icon size, and application type. Generally, application icons are added to the hicolor theme, so a square application icon 32 pixels in size would be stored in the hicolor/32x32/apps directory beneath the icon path. 2b1af7f3a8