I had a similar problem and the solution was to chmod +x lib/jspawnhelper in the JRE folder.
java - Process Builder says permission denied - Stack Overflow
-bash: ./java: Permission denied - Unix & Linux Stack Exchange
Getting error=13, Permission denied when using try to use the documented code
Snap cannot run "java" error=13, Permission denied
I just had the same problem in my code. i solved this by add waitFor after exec. The "chmod" process is not finished when next command is executed. the code may look like:
p = Runtime.getRuntime.exec("chmod 777 xxx");
p.waitFor();
Runtime.getRuntime.exec("./xxx");
I'd guess that chmod is a shell command, not an executable. Try running chmod through your shell. See more details here: Want to invoke a linux shell command from Java
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.
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();
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
Ensure you that you have read and execute access to all parent directories as well.
Example:
chmod o+x /home/user
Finally I have solved the problem. One of the directory in path haven't executable permission for other group, so as @JustinKSU suggested, there was no possibility to go throught whole path.
chmod o+x /home/user solved the problem.