Jar File won't launch from a loader

I have a loader application pertains to an application which is needed to run first to launch the main jar program.

If the program was launched through terminal as java -jar jarfile.jar, it works fine.
sequence goes to loader.jar runs , and which run is clicked in the loader, main program launches…

now I created a desktop file to have it launched in that file,
loader opens but when run is clicked from the loader, it doesnt works.

[Desktop Entry]
Name=jar
Comment=
Exec=java -jar /home/echo26/Programs/jar/loader.jar
Icon=/home/echo26/Programs/jar/jar.png
Terminal=falsey
Type=Application

maybe someone knows the solution for this.

I would change that to false

I did, both true and false were tested. Still ain’t got it working.still searching for solutions.

Check the permissions on the .desktop file.

Perhaps try and compare when KDE creates a desktop file:

  1. Right click the Plasma Desktop and select > “Create New” > “Link to Application”
  2. Click the “Application” tab and enter the command
  3. On the “Application” tab click “Advanced Options” and check “Run in Terminal”
  4. Click the Permissions tab and click “Is executable”

You can always right click the desktop icon and select “Properties”.
View this file in $HOME/Desktop to your file, not only the contents but the permissions.
Just move this file as needed.

1 Like

Did you try the suggestion - using a script launched from a desktop file?

Yes sir, tried it. (after a ton of googling stacksoverflow, qoura., and some random sites)I’ve been working for these desktop config for hours and finally I solved it. I got it working by making an sh file to the .local/bin as app.sh and then specifying the exact path to the loader and the main app.

java -noverify -javaagent:/home.../app-loader.jar -jar /home/......mainapp.jar

and then created a Desktop File to bin/share/applications with these command

[Desktop Entry]
Name=App
Exec=/home/…/app.sh
Comment=
Terminal=false
Icon=/home/index.png
Type=Application

By the way I found the solution when Error: Unable to access jarfile by having the terminal open during the launch.

it freaking works after all, thanks yall.
Im still creeping out here migrating from Windows to linux. Windows just making me crazy due to lag issues even after removing bloatwares…

I just found what Aalacarte was so It’ll be a lesson for me as well, just saving this because someone might stumble on this the same issue,

1 Like

As part of xdg specification - a .desktop file should not have the executable bit set.

Just check with the specification and verify by running this in terminal

ls -lA /usr/share/applications

That is the best method to make complicated command line work with a desktop launcher.

I suppose you meant /usr/share/applications - a local launcher is usually placed in your home location

~/.local/share/applications
1 Like

I hear you on this point, but Plasma will make it executable. I created the desktop file using the above procedure. I did not explicitly make it executable, but when I viewed the file in the Desktop directory execute permission was set. I removed the permission and when I clicked the desktop file on the Desktop I got a prompt, “This will start the program”. I clicked “Continue”, checked the file, and it was executable again.

So I moved the desktop file to another directory (make sure there wasn’t anything “special” with Desktop), double-clicked the .desktop file in Dolphin and it ran. I then removed the execute permission, ran it, and when I went back to look at the desktop file the execute permission was set.

Of the 134 files in /usr/share/applications, 68 or ~51% are executable :slight_smile:
find /usr/share/applications -type f -perm -a=x|wc -l
find /usr/share/applications -type f ! -perm -a=x|wc -l

If I executed the .desktop file using xdg-open, it indeed did not have to be executable :slight_smile:

2 Likes

I see - that is new to me :slight_smile: - this must be something KDE specific then because it is not required by the specification.

I am using Openbox and all launchers in the applications folder is not executable - that is with a single exception - which I believe is installed with the timeshift package.

Folder listing
$ ls -lA /usr/share/applications
-rw-r--r-- 1 root root   210  4 nov  2019 arandr.desktop
-rw-r--r-- 1 root root  4539 13 mar  2020 avahi-discover.desktop
-rw-r--r-- 1 root root  3971 13 mar  2020 bssh.desktop
-rw-r--r-- 1 root root  3905 13 mar  2020 bvnc.desktop
-rw-r--r-- 1 root root   379 26 jun 12:00 cmst.desktop
-rw-r--r-- 1 root root   291 26 okt 15:39 compton.desktop
-rw-r--r-- 1 root root   166 14 aug 11:47 conky.desktop
-rw-r--r-- 1 root root 13176 28 okt 15:00 firefox.desktop
-rw-r--r-- 1 root root  6099 28 sep 10:04 gcr-prompter.desktop
-rw-r--r-- 1 root root  1589 28 sep 10:04 gcr-viewer.desktop
-rw-r--r-- 1 root root  6830 19 maj 10:06 gkbd-keyboard-display.desktop
-rw-r--r-- 1 root root  6798 26 sep 23:19 gnome-disk-image-mounter.desktop
-rw-r--r-- 1 root root  6992 26 sep 23:19 gnome-disk-image-writer.desktop
-rw-r--r-- 1 root root 12833 20 jan  2020 gparted.desktop
-rw-r--r-- 1 root root  7461  7 jul 18:48 gpicview.desktop
-rw-r--r-- 1 root root   201  6 okt 23:56 gtk3-demo.desktop
-rw-r--r-- 1 root root   221  6 okt 23:56 gtk3-icon-browser.desktop
-rw-r--r-- 1 root root   246  6 okt 23:56 gtk3-widget-factory.desktop
-rw-r--r-- 1 root root   465 24 maj 22:21 jgmenu.desktop
-rw-r--r-- 1 root root   210  7 maj  2018 kickshaw.desktop
-rw-r--r-- 1 root root  1468 10 okt 15:03 kvantummanager.desktop
-rw-r--r-- 1 root root  6459  7 jul 14:45 libfm-pref-apps.desktop
lrwxrwxrwx 1 root root    43  2 nov 17:28 libreoffice-base.desktop -> /usr/lib/libreoffice/share/xdg/base.desktop
lrwxrwxrwx 1 root root    43  2 nov 17:28 libreoffice-calc.desktop -> /usr/lib/libreoffice/share/xdg/calc.desktop
lrwxrwxrwx 1 root root    43  2 nov 17:28 libreoffice-draw.desktop -> /usr/lib/libreoffice/share/xdg/draw.desktop
lrwxrwxrwx 1 root root    46  2 nov 17:28 libreoffice-impress.desktop -> /usr/lib/libreoffice/share/xdg/impress.desktop
lrwxrwxrwx 1 root root    43  2 nov 17:28 libreoffice-math.desktop -> /usr/lib/libreoffice/share/xdg/math.desktop
lrwxrwxrwx 1 root root    50  2 nov 17:28 libreoffice-startcenter.desktop -> /usr/lib/libreoffice/share/xdg/startcenter.desktop
lrwxrwxrwx 1 root root    45  2 nov 17:28 libreoffice-writer.desktop -> /usr/lib/libreoffice/share/xdg/writer.desktop
lrwxrwxrwx 1 root root    49  2 nov 17:28 libreoffice-xsltfilter.desktop -> /usr/lib/libreoffice/share/xdg/xsltfilter.desktop
-rw-r--r-- 1 root root 10970  6 okt 16:57 lxappearance.desktop
-rw-r--r-- 1 root root  4509  8 mar  2020 lxsession-default-apps.desktop
-rw-r--r-- 1 root root  5623  8 mar  2020 lxsession-edit.desktop
-rw-r--r-- 1 root root  4803  7 jul 14:45 lxshortcut.desktop
-rw-r--r-- 1 root root   537  7 okt 02:08 micro.desktop
-rw-r--r-- 1 root root 10376  4 nov 09:35 mimeinfo.cache
-rw-r--r-- 1 root root  7063 24 jan  2020 mintstick.desktop
-rw-r--r-- 1 root root  6356 24 jan  2020 mintstick-format.desktop
-rw-r--r-- 1 root root  9748 24 jan  2020 mintstick-format-kde.desktop
-rw-r--r-- 1 root root 11324 24 jan  2020 mintstick-kde.desktop
-rw-r--r-- 1 root root   525 16 apr  2020 nitrogen.desktop
-rw-r--r-- 1 root root   234 30 okt 20:11 nvidia-settings.desktop
-rw-r--r-- 1 root root   718  7 jul 22:27 obconf.desktop
-rw-r--r-- 1 root root   562 17 mar  2018 obkey.desktop
-rw-r--r-- 1 root root   338 24 maj 04:55 openbox.desktop
-rw-r--r-- 1 root root 20942 26 sep 23:19 org.gnome.DiskUtility.desktop
-rw-r--r-- 1 root root 16323  2 nov 20:21 org.gnome.Epiphany.desktop
-rw-r--r-- 1 root root  7377 12 sep  2019 pcmanfm.desktop
-rw-r--r-- 1 root root  6539 12 sep  2019 pcmanfm-desktop-pref.desktop
-rw-r--r-- 1 root root   272 26 okt 15:39 picom.desktop
-rw-r--r-- 1 root root   653 14 sep 17:01 qpdfview.desktop
-rw-r--r-- 1 root root  1661 20 jul 19:30 qt5ct.desktop
-rw-r--r-- 1 root root   276  4 jun 11:18 qv4l2.desktop
-rw-r--r-- 1 root root   193  4 jun 11:18 qvidcap.desktop
-rw-r--r-- 1 root root  3511 15 maj 21:17 sakura.desktop
-rw-r--r-- 1 root root   441 30 okt 03:02 sublime_merge.desktop
-rw-r--r-- 1 root root   532  1 okt  2019 sublime_text.desktop
-rw-r--r-- 1 root root   171  7 okt 21:37 termite.desktop
-rw-r--r-- 1 root root  6742 29 aug 02:59 thunderbird.desktop
-rwxr-xr-x 1 root root  1070 14 maj 17:05 timeshift-gtk.desktop
-rw-r--r-- 1 root root  3953  7 jul 17:59 tint2conf.desktop
-rw-r--r-- 1 root root  1425  7 jul 17:59 tint2.desktop
-rw-r--r-- 1 root root  1912 15 okt 17:07 uxterm.desktop
-rw-r--r-- 1 root root  5332 24 jun 15:03 xed.desktop
-rw-r--r-- 1 root root  1921 15 okt 17:07 xterm.desktop
1 Like

It seems this is some sort of pseudo security. The desktop file doesn’t have to be executable. When it is not, the user will be prompted if executed from the Desktop or via the Desktop’s file manager (Dolphin, Thunar).

xdg-open doesn’t care because it knows to look inside of the .desktop file.

So on any system, at least KDE and XFCE, there is going to be a mixture of desktop files that are executable and not executable.

I looked on XFCE and there are only two desktop files that are executable in /usr/share/applications and they are both KDE Plasma apps.

1 Like

We learn something new every day.

I just looked over my local set of shortcuts - they are all executable - I will have to see why.

One thought is because it is possible to mark them trusted by the app installing it.

I think the pcmanfm does something different - default asking (Setting an option *Don’t ask options on launch executable file` remove the prompt) but not changing exec bit.

Changing to non exec - does change anything - they are launched anyway.

This was the most helpful discussion on this topic:

It starts out saying there is a mixture of permissions on desktop files and what should it be if a user (i.e., distribution) wants to be consistent :slight_smile:

Yes sir that’s right, its in the home directory. I am just starting to grasp what with the linux environment and hey , community here is great. Now my only problem was with my iwlwifi driver not sure why its doesnt connect even it did not came from hibernation. which is quite weird adn contradicts the stated bugs of iwlwifi to Centrino 6502 card. Thanks a lot.

You’re amazing , seems a reader of the xde patch notes?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.