20

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

2

7 Answers 7

12

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!

4
  • 5
    This 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
    Commented Dec 2, 2015 at 17:18
  • @Raymond I'm pretty sure no but I can't be positive as I haven't messed with this since a while.
    – Insane
    Commented Dec 2, 2015 at 19:44
  • 4
    I used %SystemRoot%\explorer.exe "path to jar" to avoid cmd window
    – Barun
    Commented Jan 2, 2019 at 13:00
  • 1
    The question is about start menu, not taskbar. The answer works for neither for me, the cursor has a "No" symbol when dragging to start button or taskbar. It works with javaw instead of %SystemRoot%\system32\cmd.exe /C for the taskbar, but not for the start menu. The other answer works.
    – root
    Commented May 10, 2020 at 8:24
15

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.

4
  • 2
    This 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. Commented Jan 25, 2016 at 4:34
  • 1
    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! Commented May 14, 2018 at 14:02
  • Unfortunately, this method still won't allow you to pin it to the task bar :( Commented Nov 2, 2018 at 19:19
  • For me, I had to do the first part adding it to Start Menu\Programs, then I had to search for it, then I could right-click and add it to the start menu.
    – ScrappyDev
    Commented Jun 3 at 0:15
8

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.

1
  • 1
    Doesn't start the application in the specified directory of the shortcut, causes issue for a lot of application using external files. Commented May 14, 2018 at 13:56
4

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.

4

Super clean and easy solution:

  1. Temporarily rename .jar file to .exe
  2. Create shortcut and pin to start
  3. Change .exe back to .jar and right click start menu item > more > open file location > right click > properties and change extension to .jar
  4. profit!
0

Make a Shortcut to Desktop:Rename /change icon now if you want. Move the jar file to C:\ProgramData\Microsoft\Windows\Start Menu\Programs. Once you move the jar file right click/properties and find Target: at the very beginning of the Line add C:\Windows\explorer.exe this will add the jar file to the list of Recently added Programs (Win10 thinks you "install" this Program) now you can added to the taskbar or the start menu shortcuts.

0

Based on the elegant solution from @Kameryn:

Here is how to do it in win11:

  1. Copy your .jar file to .exe
  2. Drag the .exe file to the process line
  3. Right click the link in the process line
  4. Right click on the file name above the unpin option
  5. Click on properties
  6. Change the icon (you get an error pop up: No icon. Click OK and select an icon)
  7. Click OK on all the pop-up windows, you will now have the link in the process line with the right icon
  8. Right click the link in the process line
  9. Right click on the file name above the unpin option
  10. Click on properties
  11. Change the target to end in .jar instead of .exe
  12. Click OK
  13. Delete your .exe copy

Note that you cannot combine changing icon and target in one go. If you don't care about the icon, skip step 6-10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .