Windows 7 - How to pin a .jar to the taskbar?

26

5

I have a .jar that I run frequently, and I'd like to pin it to the taskbar. I've tried pinning the .jar itself, and I've tried pinning a .bat file that has the command to run the .jar, but it doesn't work either. Is there a way to accomplish this?

gunit888

Posted 2011-03-14T14:18:00.540

Reputation: 393

I changed my answer choice to the javaw.exe version because it eliminates the command window issue. However, the cmd.exe is still a very useful trick to have available. – gunit888 – 2011-03-14T20:27:14.770

Answers

27

Similar to MJH's answer, but instead of cmd.exe, you could specify the following path to the executable to avoid having the Command Prompt showing up:

javaw.exe -jar "C:\path\to\your\executable.jar"

If you are the developer of the Java project, you might want to see my answer on StackOverflow as to getting it to play nicely with Windows 7.

Paul Lammertsma

Posted 2011-03-14T14:18:00.540

Reputation: 3 508

eh, i dont get this answer properly. Should I make the *.bat as the command prompt execution using the above code? then make it (bat) pinned to the taskbar? coz i dont see any 'Pin to Taskbar' menu from that file.... – gumuruh – 2018-09-18T03:32:45.307

1This is an extremely old answer and may be outdated, but the idea here was to create a shortcut as described in MJH's answer below. – Paul Lammertsma – 2018-09-18T09:23:36.200

Note: Replace the entire target string with Paul's answer. (Don't leave the cmd path or \C in there.) – takanuva15 – 2019-10-30T14:34:05.737

Thanks, this matches perfectly with what I wanted to accomplish. – gunit888 – 2011-03-14T20:26:16.470

Except maybe a pretty icon, perhaps. I couldn't get this to work (maybe a reboot is required?) but you could try Shift + right-clicking the icon, selecting properties and specifying an icon. I'm curious if you can get that to work. – Paul Lammertsma – 2011-03-14T23:22:00.783

I was able to assign an .ico file to the shortcut, but it was external to the .jar. Windows 7 doesn't seem to be able to look inside .jar files for icons, as far as I can tell anyway. – gunit888 – 2011-03-15T13:59:33.997

That's correct. Unless to wrap the JAR as a Windows executable (using Launch4j, JSmooth or some similar tool), this is really the only way of associating an icon with it.

– Paul Lammertsma – 2011-03-15T14:01:38.267

8

  1. Create shortcut for cmd.exe

  2. Right click the shortcut and select properties.

  3. In the box for Target, go to the end of %SystemRoot%\system32\cmd.exe.

  4. After that Target, type a SPACE and then /C, another SPACE and the path to the .jar file.

  5. Pin the shortcut to the taskbar.

You can also change the Icon or click the General tab and change the name of the shortcut if you wish.

MJH

Posted 2011-03-14T14:18:00.540

Reputation: 505

1Thanks, that works. However, the cmd.exe window stays open, is there a way to have that automatically close once the .jar is running? – gunit888 – 2011-03-14T15:47:58.970

1

as this answer says, you should only type in your target properties of your shortcut:

explorer "path_of_jar_file"

just this!

Mohammad_Hosein

Posted 2011-03-14T14:18:00.540

Reputation: 11

If the answer is better than the one accepted, vote to close this question. – Toto – 2018-03-19T13:09:30.277

This is the answer and it works on Windows 10 – Pimenta – 2019-07-12T15:17:26.603

-1

For those having issues with the CMD window remaining open, you can do exactly like MJH described, but instead of /C try /C START and then the path to your jar file.

Patherros

Posted 2011-03-14T14:18:00.540

Reputation: 1

-1

With MJH solution you can opt to run the cmd minimized instead of normal window to avoid having to close the window

Murtaza Chiba

Posted 2011-03-14T14:18:00.540

Reputation: 1