You are not logged in.

#1 2017-10-27 01:18:02

waterquarks
Member
Registered: 2017-10-26
Posts: 6

Cannot execute jars as user

Hi,
while trying to run a .jar file as an user, I get this error:

java.io.FileNotFoundException: /home/waterquarks/.minecraft/libraries/optifine/OptiFine/1.12.2_HD_U_C6/OptiFine-1.12.2_HD_U_C6.jar (Permission denied)

I don't want to execute the jar as root, because it would install the addon (it's for a game) in a not-so-friendly path, and because the game, on run, would ignore all the settings I have for the user. I have the ownership of the folder in which the file is located.

Any insight on this?
Thanks in advance!

EDIT: how do I format the log in a separate text box?

Last edited by waterquarks (2017-10-27 01:56:15)

Offline

#2 2017-10-27 01:51:03

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: Cannot execute jars as user

Does this happen only with minecraft, or is it a problem with every .jar file?  And when posting a lot of text or command output, you can use [ code ] Text here [ /code ]   (remove the spaces in the [ code ] tags.  https://bbs.archlinux.org/help.php#bbcode

Offline

#3 2017-10-27 01:57:44

waterquarks
Member
Registered: 2017-10-26
Posts: 6

Re: Cannot execute jars as user

circleface wrote:

Does this happen only with minecraft, or is it a problem with every .jar file?  And when posting a lot of text or command output, you can use [ code ] Text here [ /code ]   (remove the spaces in the [ code ] tags.  https://bbs.archlinux.org/help.php#bbcode

It happens with every .jar file -well, any file that isn't specifically user created-. For example, I can only use sudo nano to edit config files, because if I use something like Notepadqq or gedit it would give me a "Permission denied" on any saving attempt. I think it has to do something with the permissions thing, but I already have myself in the sudoers with all root permissions.

Last edited by waterquarks (2017-10-27 01:58:58)

Offline

#4 2017-10-27 02:01:38

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: Cannot execute jars as user

Can you paste the output of:

ls -l /home/waterquarks/.minecraft/libraries/optifine/OptiFine/1.12.2_HD_U_C6/

Offline

#5 2017-10-27 02:03:10

waterquarks
Member
Registered: 2017-10-26
Posts: 6

Re: Cannot execute jars as user

circleface wrote:

Can you paste the output of:

ls -l /home/waterquarks/.minecraft/libraries/optifine/OptiFine/1.12.2_HD_U_C6/

Here it is:

[waterquarks@arch ~]$ ls -l /home/waterquarks/.minecraft/libraries/optifine/OptiFine/1.12.2_HD_U_C6/
total 1904
-rw-r--r-- 1 root root 1949014 Oct 26 18:09 OptiFine-1.12.2_HD_U_C6.jar
[waterquarks@arch ~]$ 

Offline

#6 2017-10-27 02:08:35

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: Cannot execute jars as user

Yep, permission error.  That file is owned by root, so only the root user (or your user using sudo) can use it.  You can use

chown youruser:youruser OptiFine-1.12.2_HD_U_C6.jar

and see if that helps.  If it doesn't, you may need to keep going to the parent directory until all files are owned by you.

Offline

#7 2017-10-27 02:13:39

waterquarks
Member
Registered: 2017-10-26
Posts: 6

Re: Cannot execute jars as user

circleface wrote:

Yep, permission error.  That file is owned by root, so only the root user (or your user using sudo) can use it.  You can use

chown youruser:youruser OptiFine-1.12.2_HD_U_C6.jar

and see if that helps.  If it doesn't, you may need to keep going to the parent directory until all files are owned by you.

It worked, thank you!

Offline

#8 2017-10-27 02:29:35

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: Cannot execute jars as user

No problem smile

Make sure you mark your thread as solved by editing the first post and prepending [SOLVED] to the title.

Offline

#9 2017-10-27 02:59:35

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: Cannot execute jars as user

waterquarks wrote:

[
It happens with every .jar file -well, any file that isn't specifically user created-. For example, I can only use sudo nano to edit config files, because if I use something like Notepadqq or gedit it would give me a "Permission denied" on any saving attempt. I think it has to do something with the permissions thing, but I already have myself in the sudoers with all root permissions.

Well, you wouldn't normally use a graphical text editor to edit system configuration files, would you? If you're talking about files in your home directory, there is something very wrong indeed if you need sudo to edit them at all - and using sudo to edit them will only make matters worse.

How did that jar file come to be owned by root in the first place?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB