How is running a jar file from terminal different from running it directly??
What I want to ask is, I made a GUI application and added a launcher icon to it. When I run it from terminal, it shows the launcher icon and I can as obvious lock that icon to the launcher. But, when I run it directly, it shows the default jvm icon instead of the launcher icon I added. And, if I lock that icon to the launcher, and try to run the app by clicking the icon, it just doesn't do anything??
Is their any way, that it shows the same launcher icon I added to it??
You need to set the dock icon in OSX for this to work.
Possible duplicate of the question : How do you change the Dock Icon of a Java program?
Additionally, refer this documentation : https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/00-Intro/JavaDevelopment.html
Related
On a Mac, there is a button on the screen menu bar that is the name of an application. For example, for terminal, there is a button at the top of the screen labeled Terminal. When you click it, there is a options that says About Terminal. When this is clicked, it shows information about the application. Here is a picture:
How can I add this to my application in Java? When I do this now, this is what shows up:
As you can see, it shows the Java version etc. Is there a way to change this into a more professional format?
If your Window extends JFrame, just use the setIconImage or setIconImages method to set your icon.
From the corresponding JavaDoc:
Sets the image to be displayed as the icon for this window.
The other information is read from the executable metadata. If you run your app using Java directly, you can't change it. For my applications, I generate an executable file using Install4J, where the installer adds the metadata to the generated executable.
Thanks, I've solved the problem. It was a simple mistake, when I packaged it together using a packager it worked fine. Thanks for all your help!
I've created a Java Application kind of like Notepad, I created a jar file, I did not want the icon to be the default Java Jar Icon, so I uploaded a icon.ico so the Icon would appear in Taskbar,Desktop, and also at the top-left of the application, when I run it, it works fine. I created an installer and uploaded it online so I can download it from my other computer and try it, when I download it the App works fine, but the icons do not show up, it shows the default Jar File Icon in the taskbar and top-left of application, but in the desktop it shows the Icon that I choose. Anyone knows do I have to upload anything with the Installer.exe Folder or? Thank you in advance.
I have a program that uses a GUI with the .jar file and resources packaged into a .app file with a custom icon for the .app and I wanted to know if it was possible to hide the java icon while still displaying the GUI from my .jar. Right now when I execute the .app it shows 2 icons, the icon for the application and for the .jar itself when I only want the application icon to show in the dock. I tried using -Djava.awt.UIElement=true and headless arguments but those prevent my GUI from showing.
EDIT: Or if it's possible to change the icon and label of the java icon itself to the icon I want that would work too
I have searched on the net, but I have not found anything for my case.
I have created an application, that shows only in the SystemTray (icon) when you start. I want to run the jar file or the exe automatically when windows starts.
I would like to do this via code or automatically directly from my app. A menu item (for example) that the user could click on that option, if desired. I searched the internet but have not found anything.
Thank you in advance
Thank you very much
Only code Java or Bat
I think you can register your application as a system service, set the starttype auto start
Follow the below steps for windows 7
1)Click the Start windows button , click All Programs, right-click the Startup folder, and then click Open.
2) Open the location that contains the item you want to create a shortcut to.
3) Right-click the item, and then click Create Shortcut. The new shortcut appears in the same location as the original item.
4) Drag the shortcut into the Startup folder.
The next time you start Windows, the program will run automatically.
I got from this link
I made a JavaFX application on Netbeans and I put this code for setting the icon to the window
primaryStage.getIcons().add(new Image("file:sicadcam.png"));
and when I run the project from Netbeans, it works ok: the icon appears on the window and in the taskbar. where I have to put the image.
When I clean and build the project, it generates two installers: one exe and one msi; and when I install the application and open it, the window doesn't have the icon sicadcam.png, it has the default java logo icon.
How or where can I set the path of the image so that when I install the application the icon appears.
You should place the icon in your jar or classpath and then load it through a resource function.
E.g. if you place it to your bin folder, into the package where your class is, then the following should work:
primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("sicadcam.png")));
I suspect that the image is not handled as a resource and not getting into your Jar file. Can you verify if it is there? (You can do that by Total Commander for example by pressing Ctrl+PgDown to go into the archive).
Another reason might be that NetBeans using a different run configuration and classpath. Where is your image? If it is in the package root (i.e., the folder which contains your top-level package), you can probably access it somehow like: ImageIO.read(getClass().getResourceAsStream("/sicadcam.png")).
Hope that helps something.