🌐
Stack Overflow
stackoverflow.com › questions › 27518480 › java-process-return-permission-denied-only-sometime
bash - Java Process return permission denied only sometime. - Stack Overflow
June 5, 2017 - ... Please check if there is any other process using or holding a handle of this directory/file that is being removed. User fuser command to check. Based on the output of fuser, the script should wait for some more time and set a timeout to ...
Discussions

java - Process Builder says permission denied - Stack Overflow
i am trying to run lighttp using process builder in android but when i run it it says permission denied. Do i have to make any permission through code please help me. this is my code. String[] More on stackoverflow.com
🌐 stackoverflow.com
-bash: ./java: Permission denied - Unix & Linux Stack Exchange
I'm trying to run Java on my web server (that is only rented). I downloaded the JRE from java.com and unpacked it in a local folder in my home directory. I changed the permissions of the bin/java More on unix.stackexchange.com
🌐 unix.stackexchange.com
September 12, 2020
Getting error=13, Permission denied when using try to use the documented code
Hi, Am using this awsome library for ffmpeg in java,i use the documeted code in github and am getting the following issue. Am using netbeans 8.2 in ubandu 16.04 also installed the ffmpeg in ubandu ... More on github.com
🌐 github.com
10
December 23, 2019
Snap cannot run "java" error=13, Permission denied
Caused by: java.io.IOException: Cannot run program "/snap/processing/8/opt/processing/lib/app/resources/jdk/bin/java": error=13, Permission denied More on github.com
🌐 github.com
3
May 5, 2025
🌐
Stack Overflow
stackoverflow.com › questions › 52132008 › java-permission-denied-when-attempting-to-execute-shell-script
command - Java - Permission Denied when attempting to execute shell script - Stack Overflow
You should be using ProcessBuilder and specifically its directory(File) which can be used to choose a different current directory for the child process. That means you are probably in the wrong directory, which could lead to a "permission denied" ...
🌐
Stack Overflow
stackoverflow.com › questions › 20852951 › process-builder-says-permission-denied
java - Process Builder says permission denied - Stack Overflow
i am trying to run lighttp using process builder in android but when i run it it says permission denied. Do i have to make any permission through code please help me. this is my code. String[] serverCmd = { getAppDirectory() + "/lighttpd", "-f",getHttpDirectory() + "/conf/lighttpd.conf", "-D"}; try { (new ProcessBuilder(serverCmd)).start(); Log.i(TAG, "LIGHTTPD is successfully running"); } catch (java.lang.Exception e) { Log.e(TAG, "Unable to start LIGHTTPD", e); } Logcat: 12-31 06:07:21.394: E/Social engineering Toolkit!(3562): Unable to start LIGHTTPD 12-31 06:07:21.394: E/Social engineering Toolkit!(3562): java.io.IOException: Error running exec().
🌐
Coderanch
coderanch.com › t › 591281 › java › ProcessBuilder-Permission-Denied-Error
ProcessBuilder and Permission Denied Error (Distributed Java forum at Coderanch)
The directory and executable itself has full permission, but some how cannot be launched by a Java process. As described in above link, does this issue have more to do with Redhat enviornment or Java? Any advice, I'd greatly appreciated it.
🌐
GitHub
github.com › kokorin › Jaffree › issues › 61
Getting error=13, Permission denied when using try to use the documented code · Issue #61 · kokorin/Jaffree
December 23, 2019 - 41 more Caused by: java.io.IOException: error=13, Permission denied at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang....
Author   kokorin
🌐
Broadcom
knowledge.broadcom.com › external › article › 103042 › permission-denied-error-when-starting-ja.html
Permission Denied error when starting Java based processes (JWP & JCP).
October 30, 2023 - When starting either the JWP or JCP the following exception is shown in the log file: Exception in thread "main" java.lang.RuntimeException: ../AutomationEngine/bin/configuration/0/org.eclipse.osgi/.manager/.fileTableLock (Permission denied) Release: 12.3,12.2 Component: Automic Automation Engine · Configuration. The file org.eclipse.osgi is owned by root, therefore the Java processes cannot be started as user automic.
Find elsewhere
🌐
GitHub
github.com › processing › processing4 › issues › 1074
Snap cannot run "java" error=13, Permission denied · Issue #1074 · processing/processing4
May 5, 2025 - ls -ahl /snap/processing/8/opt/processing/lib/app/resources/jdk/bin/java Permissions Size User Date Modified Name .rw-r--r-- 16k root 25 apr 15:10 /snap/processing/8/opt/processing/lib/app/resources/jdk/bin/java
Author   processing
🌐
Hewlett Packard Enterprise
community.hpe.com › t5 › General › java-execute-permission-denied › td-p › 5108983
Solved: java execute permission denied - Hewlett Packard Enterprise Community
May 19, 2008 - hi, >$ cd /home/reports/apps/javaapp/jre1.6.0_04/bin/ >$ java -version >su: java: Execute permission denied. >$ Please run the java command as follows (using the "./") ./java -version We need to make sure that the java is really from the mentioned directory. Also post the output of: echo $PATH revert!
🌐
Opencore
opencore.com › blog › 2018 › 7 › sssd-enumerate
FileNotFoundException: Permission denied - A chase through the OpenJDK, Python and Linux source — OpenCore
Everything should work, right? keystore.jks belongs to group hadoop. Members of that group, which we are, should be able to read it. Instead we got a permission denied exception like this: java.io.FileNotFoundException: /opt/hadoop/keystore.jks (Permission denied)
🌐
Stack Overflow
stackoverflow.com › questions › 60577467 › getting-permission-denied-when-executing-commands-using-process-builder
java - Getting Permission denied when executing commands using Process Builder - Stack Overflow
March 7, 2020 - ... Presumably you don't have execute rights on the file. If you ls -l it should show a x somewhere in the first column. ... That'll be a link. The file linked to will also need execute permissions.
🌐
JBoss.org
developer.jboss.org › thread › 205299
java.io.IOException: Cannot run program error=13| JBoss.org Content Archive (Read Only)
September 12, 2012 - What it looks like might be happening is that the SUDO_USER environment variable is being referenced to determine who is originating the command, and the java process tries to set its working directory to the originating user’s home directory. I really don’t see any other way for that ...
🌐
GitHub
github.com › comp500 › SSLSocks › issues › 23
Caused by: java.io.IOException: error=13, Permission denied · Issue #23 · comp500/SSLSocks
December 27, 2020 - E/StunnelProcessManager: failure java.io.IOException: Cannot run program "/data/user/0/link.infra.sslsocks/files/stunnel" (in directory "/data/user/0/link.infra.sslsocks/files"): error=13, Permission denied at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050) at java.lang.Runtime.ex...
Author   comp500
🌐
GitHub
github.com › epickrram › grav › issues › 12
Permission Denied error while attaching to java process inside the container. · Issue #12 · epickrram/grav
July 2, 2018 - Hi team, We aren't able to attach to the java process. Got the below mentioned error while trying to attach to the java process which resides inside the container from the host. Changed the owner permission to all the scripts and tried a...
Author   epickrram
Top answer
1 of 2
1

Does the code block? If it doesn't, there should be no ramifications of running it in the main thread. You can, however, do that from another thread, with:

Context.runOnUiThread(new Runnable() {
    getPathOfExecutable();
});

This is the cleanest work around I can think of, short of editing the permissions of your file (that you can't get the path of without running your code on the main thread anyways) because you have r/w privileges on /proc/self/exe.

This is very weird, and I am still researching the permission differences in different threads on android.

If you can get it working in the main thread, my opinion would be to just do it in the main thread, and not worry much about optimization, as the performance is no different on different threads.

2 of 2
0

What would be a workaround to get the path of the current executable?

Since every Android app is forked from Zygote, which is the first Java vm process when the virtual machine created by /system/bin/app_process at system booting.

If you try to read the /proc/self/exe from your Android app, the actual executable will be /system/bin/app_process. Even if you read this outside of your app's main thread, the result is the same and it wouldn't have the permission error in theory.

The question you asked is a kind of weird problem, I have tested with the following code on Android 2.3.3 and worked fine.

new Thread() {

    /* (non-Javadoc)
     * @see java.lang.Thread#run()
     */
    @Override
    public void run() {
        // TODO Auto-generated method stub
        super.run();
        try {
            Log.d(TAG, new File("/proc/self/exe").getCanonicalFile().getPath());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}.start();
🌐
LinuxQuestions.org
linuxquestions.org › questions › solaris-opensolaris-20 › unable-to-run-program-permission-denied-746399
Unable to run program, Permission denied
August 10, 2009 - Hi All, I am working on Solaris Sparc 9 and I developed application and in that I want to open any file when any action is happened but when I am
🌐
Reddit
reddit.com › r/linuxquestions › why do i not have permission to run bash from java?
r/linuxquestions on Reddit: Why do I not have permission to run bash from Java?
April 4, 2022 -

When I run Java's:

      processBuilder.command("/home/myuser/ccc/server/maked.sh");

I get:

Cannot run program "/home/myuser/ccc/server/maked.sh": error=13, Permission denied

maked.sh contains:

mkdir 11111

It runs from command line fine and I delete the directory.

But from processbuilder, it gives me the above error. Processbuilder can make a directory not using bash.

       My thoughts are: 
                  1) Permission of /bin/bash maybe need changed for my myuser?
                  2) When I launch java, maybe I pass permissions to the process?
                  3) Something else. :)

I'm working on a video game for my aunt who has cancer with my cousin who was a make a wish kid(he's legit cooler than me tho, good that the next generation is cooler). I need to do account recovery so I can flag certain users as trusted to make metaverse quests in parks(don't want every random person guiding adventurers around). She can still walk though she has lymph node cancer so I want her playing it before... She inspired me to make this from similar games she played with me as a kid where instead of giving a gift, she'd give a note where another note was, until you find the gift.

Original question: https://old.reddit.com/r/linuxquestions/comments/tuyqmj/can_you_single_command_line_send_an_email_without/

Edit: Thank you guys, it was permissions. Chmod +x maked.sh