How to pin an executable jar to start in Windows 10?

11

4

I tried creating a normal shortcut, and a javaw.exe shortcut, which creates the context menu option "Pin to Start", but that does nothing.

Andreas Hartmann

Posted 2015-09-20T18:14:25.470

Reputation: 1 072

Possible duplicate of How can I pin a batch file and an internet shortcut to the taskbar in Windows 7?

– G-Man Says 'Reinstate Monica' – 2015-12-27T06:34:16.690

Answers

10

The first thing I did was make sure I had the latest Java SE and that the .JAR file association was with Java and not something else (like WinRAR)

I had to do something similar to get another application to pin to taskbar I use so I knew it had something to do with targets, and after researching a bit the same method for Windows 7 works here.

Create a shortcut for your .JAR, then right click and go to properties Edit the target to match this format:

%SystemRoot%\system32\cmd.exe /C "path to jar"

Source (except he recommends making a shortcut of cmd, I actually ran into issues for some reason)

Finally, pin your new shortcut to the taskbar by dragging it there. The icon will be the same as CMD but you can easily change it:

Hope this helps!

Insane

Posted 2015-09-20T18:14:25.470

Reputation: 2 599

3This works. But in Windows 10 when I click on the Taskbar icon, it starts two programs, one for the cmd, and one for the java program. Is there a way to omit the cmd program (or close it automatically)? – Raymond – 2015-12-02T17:18:56.883

@Raymond I'm pretty sure no but I can't be positive as I haven't messed with this since a while. – Insane – 2015-12-02T19:44:38.777

1I used %SystemRoot%\explorer.exe "path to jar" to avoid cmd window – Barun – 2019-01-02T13:00:40.120

8

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. Works on my copy of Windows 10 and avoids the CMD Window.

Richard Wheeldon

Posted 2015-09-20T18:14:25.470

Reputation: 81

1This is right. The key is that you have to drag it from your start menu 'All Apps' list itself, NOT drag the shortcut from the %APPDATA%/Start Menu/Programs folder. – Nathan Stretch – 2016-01-25T04:34:46.597

This is the best of the best answers so far. A little extra of a step, but after you place it into the Start Menu\Programs, you are able to right click - pin to start from here. Thank you! – Alex Summers – 2018-05-14T14:02:54.593

Unfortunately, this method still won't allow you to pin it to the task bar :( – Levi Fuller – 2018-11-02T19:19:10.893

5

Create a shortcut of the jar. Add 'explorer' to the beginning of the target:

"C:\Users\joe\Documents\netbeans kalendar\dist\kalendar.jar"
becomes:
explorer "C:\Users\joe\Documents\netbeans kalendar\dist\kalendar.jar"

The shortcut executes without a cmd window appearing (it uses the explorer instead.) You can pin this to the taskbar, and change it's icon.

pollaris

Posted 2015-09-20T18:14:25.470

Reputation: 151

1Doesn't start the application in the specified directory of the shortcut, causes issue for a lot of application using external files. – Alex Summers – 2018-05-14T13:56:39.297

2

I know this is an old question, but I just found a better solution:

You can execute Java directly, passing it the JAR as an argument. Set your shortcut to the following path:

javaw -jar C:\Path\To\My\Program.jar

Additionally, specify the Start in path to C:\Path\To\My if your Java program uses relative paths to reference external files.

Using javaw here instead of java prevents an empty command window from being spawned.

MTCoster

Posted 2015-09-20T18:14:25.470

Reputation: 121