Assuming you have version 9 Stretch from April 2019 running on you pi:
Once you have the .jar file made, I now have an easier way to set an association that has some advantages:
To set association for java .jar files so you can double click on it and launch, do the following:
Click on the start raspberry and select Preferrences>Main Menu Editor
pick a the 'Other' menu location on left side
click on new item
type in name you want displayed (I used ' Java Start ')
for command, use ' /usr/bin/jexec %f ' (no quote marks or spaces at beginning or end)
do not click on Launch in Terminal
click on OK
new name used should show in list on right and checked to use
click OK to finish
right click on the jar file and select 'Open With'
expand the 'Other' category
click on the new item name
set check box for 'Set selected application as default action for this file type' at the bottom
click on OK and the jar file should launch.
double clicks on any jar file will now launch it.
Java Start (or whatever you named it) will show as an option when you right click the jar file, also.
To make a desktop shortcut:
Copy the file 'Java Start ' from /home/user
/.local/share/applications that got made when you did the association above.
Paste it on the desktop
Open it with a text editor
Change the line /usr/bin/jexec %f to Exec=java -jar /home/user
.jar, assuming the jar file is also on the desktop or change the path accordingly.
Change the Name=Java Start line to a name you want to show on the desktop shortcut.
Save the file.
Now you can double click on the shortcut to launch that app (jar file).
To make the app auto launch on boot-up:
copy the desktop shortcut to the /home/user
/.config/autostart folder. You'll need admin rights (sudo) to make the copy.
You can email me at firstname.lastname@example.org