Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pinning a Java executable (with launch4j) to the Windows 7 taskbar

After spending half a day searching and trying, I'm finally giving up.

I have a java application of which I create a runnable jar (to include any other libs and just have a single jar file). With launch4j and the runnable jar I'm making an executable "MyApp.exe".

The executable ist working fine, but I want to pin it to my windows 7 taskbar. For now, I just have the taskbar entry "Close window".

After reading and implementing the following solutions with JNA

  • Pinning a Java application to the Windows 7 taskbar
  • Using JNA to get/set application identifier

my Application displays it's "Application User Model ID" correctly in the gui (just for testing purpose).

BUT: my program is shown as "javaw.exe" in the Task Manager and I still can't pin it to the taskbar, even though I set the launch4j option "custom process name and XP style manifest".

Background information: I'm working with a windows 7 admin account and I don't want the app the require admin rights.

Anyways, if I start the app "as administrator" from the context menu and confirm the UAC message, I can now pin to the taskbar. BUT: even though I set the "Application User Model ID" properly, windows still wants to pin "javaw.exe", even though my program is now shown as "MyApp.exe" in the TaskManager.

I'm totaly confused. But I'm obviously not the only one, having these issues. => See the last comments to Gregory Pakosz answer in Using JNA to get/set application identifier

Final questions:

  1. Gregory Pakosz way with JNA to set the "Application User Model ID" ( https://stackoverflow.com/a/1928830/1128689 ) is working for me. But still, windows recognizes my app as an instance of "javaw.exe". What else do I have to do?
  2. Did maybe some windows or java update break something here?
  3. Do I really have to run my app with elevated user rights? I really don't want to...
  4. Are there some more options in launch4j which I have to set?
  5. Do I have to use a manifest file in launch4j?
like image 831
ToFi Avatar asked Mar 28 '12 15:03

ToFi


People also ask

How do I pin Java to the taskbar in Windows 10?

Create a shortcut. Move the shortcut into C:\ProgramData\Microsoft\Windows\Start Menu\Programs. Then click on the start menu and drag and drop your newly added icon wherever you like.

How do I launch launch4j?

Running launch4jRun launch4j.exe or launch4j script without command line arguments to enter the GUI mode. To wrap a jar in console mode use launch4jc.exe and specify the configuration file. On Linux use the launch4j script.


1 Answers

I got this working by creating an Exe from a runnable jar with the help of JSmooth .Pinned it to the taskbar, and ran it with no problems.

Hope this helps

like image 73
Reg Avatar answered Sep 20 '22 01:09

Reg