I am trying to run a java program from another java program using Runtime.getrunTime().exec
Code :
String java_home = System.getenv("JAVA_HOME");
String[] command = {""+java_home+"/bin/java -cp -cp /sc/sug/p-lib/* Tdesigner -cd /pr -in ing.rsp -out /scratch/sug/ng.pla -ad -stopO "};
try {
proc = Runtime.getRuntime().exec(command);
proc.waitFor();
int exitCode = proc.exitValue();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
It gives me following error:
java.io.IOException: Cannot run program "/net/sl/sc/jdk6/bin/java -cp /sc/sug/p-lib/* Tdesigner -cd /pr -in ing.rsp -out /scratch/sug/ng.pla -ad -stopOnError ": java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
Can anyone help me to solve the issue. is it that i need to add individual jar files with -cp rather than setting the directory.
asked Oct 15, 2012 at 21:55
Try removing the extra -cp
from the command string array and use individual tokens in the array:
String[] command = { java_home + "/bin/java", "-cp",
"/sc/sug/p-lib/*", "Tdesigner", "-cd", "/pr", "-in", "ing.rsp",
"-out", "/scratch/sug/ng.pla", "-ad", "-stopO" };
answered Oct 15, 2012 at 22:17
ReimeusReimeus
157k15 gold badges214 silver badges273 bronze badges
If you use exec(String[]) you must provide the command and its arguments in separate array elements, not all in one as you have done.
answered Oct 15, 2012 at 22:02
2
I use scala. Here is my code:
Runtime.getRuntime.exec(Array("/bin/bash", "-c", #your_command)).waitFor()
I think it is easy to understand for others who use java.
answered Jun 17, 2014 at 18:58
HaimeiHaimei
12.3k3 gold badges49 silver badges35 bronze badges
Содержание
- java.io.IOException: error=2, No such file or directory #1
- Comments
- [Solution] Git Clone Error: java.io.IOException: error=2, No such file or directory
- Issue:
- Solution:
- Jenkins Git Configuration
- java.io.IOException: Cannot run program «java com.alter.change.on.demand.jobs.HelloWorld2»: error=2, No such file or directory
- 1 Answer 1
- Related
- Hot Network Questions
- Subscribe to RSS
- After using android studio 3.1.2 it showing error=2, No such file or directory
- Hadoop Streaming — Unable to find file error
- 8 Answers 8
java.io.IOException: error=2, No such file or directory #1
@knorwood — Firstly, thanks for getting this out! Really great stuff.
I’ve hit a small issue in that java can’t find my program:
java.io.IOException: Cannot run program «consumers.py»: error=2, No such file or directory
I’ve set the executableName = consumers.py in my properties file. Is that path relative to dir in which I’m running the command? Or is absolute? (I’ve tried both, with no luck).
Also, I can’t seem to find much on the recommended way to daemonize the process?
The text was updated successfully, but these errors were encountered:
If anyone comes along later, the path is (or can be) absolute. And to daemonize, look no further than supervisord
Thanks for the feedback and glad to hear you’ve gotten things working.
I’ll clarify some more for others. The MultiLangDaemon uses the environment that the jvm was launched in. On linux/unix systems the relevant environment variable that it uses to find the executable is PATH. You can test that your executable will be found using which (filling in the executable’s name). I usually install my python packages within a virtualenv so I don’t have to manually fiddle with the PATH variable.
Thanks @knorwood — I had a few issues getting the virtualenv working as expected; I’m passing longer-running consumer tasks off to celery and it was a bit fiddly to get the celery app/imports working correctly.
Can I suggest a little more in the docs to demonstrate the optimal virtualenv-based setup? Perhaps out of scope though.
But again, thanks for getting this out — I was running a «consumer» with celery tasks until now, which worked, but very happy to using the official KCL without having to dive into java.
For other people who might come across this issue due to the same «No such file or directory» error message from Java, the solution is simply to make the Python script executable and define the path in the properties file as executableName = ./consumers.py instead of just providing the file name.
still no luck with @Tenzer ‘s solution. set executable permissions to 755 and even tried to modify the PATH for the command..
PATH=/Users/sid137/ivizone/kinesis-access-point-monitor:$PATH python amazon_kclpy_helper.py —print_command —java /usr/bin/java —properties app.properties
@sid137 Do you have app.py in the current working directory while running that command?
Also, just to be sure — you made app.py executable and not amazon_kclpy_helper.py , right?
That’s correct. I run tht command from the same directory as app.py and
app.properties
App.py is what has the file permissions set to 755
I can create a sample repo when I get home if that’s helpful
Although I basically took the sample app code and modified it locally to
just get something up and running on my stream
On Thursday, October 30, 2014, Jeppe Toustrup notifications@github.com
wrote:
@sid137 https://github.com/sid137 Do you have app.py in the current
working directory while running that command?
Also, just to be sure — you made app.py executable and not
amazon_kclpy_helper.py, right?
—
Reply to this email directly or view it on GitHub
#1 (comment)
.
Another approach to try is to define the executableName to be python with the full path to the script as its argument, like this.
Another approach that I’d suggest if you’re using virtualenv, is to define a setup.py and install your script before running the MultiLangDaemon. Your setup.py should minimally contain:
And setuptools should install the script appropriately.
Источник
[Solution] Git Clone Error: java.io.IOException: error=2, No such file or directory
Issue:
In Jenkins, when I am trying to clone a git repository I am getting the following error.
Solution:
This is a common issue which occurs when you are configuring a new Jenkins or configuring it for the first time.
Make sure you have the following settings already configured. It could be because of these reasons as well.
- Git should be installed on the slave where you are trying to clone the repo.
- Your git repo should be accessible from the slave machine.
- You should have Git Plugin installed on Jenkins
If the above prerequisites are met and you are getting the error, then is a Jenkins git configuration issue. You need to configure git on Jenkins.
Jenkins Git Configuration
Step 1: Login to your slave machine and get the git executable path using the following command.
You should see something as shown below.
/bin/git is the git executable location
Step 2: Go to Manage Jenkins –> Global Tool Configuration
Step 3: Add the git executable path you got in Step 1 as shown below.
Thats it! now if you build your Jenkins jobs, you should not see the error! Please comment below if you think there are more edge cases in this type of errors.
Источник
java.io.IOException: Cannot run program «java com.alter.change.on.demand.jobs.HelloWorld2»: error=2, No such file or directory
java.io.IOException: Cannot run program «java com.alter.change.on.demand.jobs.HelloWorld2»: error=2, No such file or directory
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
Exception in thread «main» java.lang.NullPointerException
1 Answer 1
-Separating the values passed in the ProcessBuilder with commas(,) worked for me and also making sure the java command is executed from the directory that contains the class file. -Also when executing from command line the package name had to be included followed by the class name for example in this case : java com.alter.change.on.demand.jobs.HelloWorld(keeping in mind it is the current directory contains the class file or the -cp option should be used for providing the path for the directory where the class file is present)
Hot Network Questions
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.1.14.43159
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
After using android studio 3.1.2 it showing error=2, No such file or directory
After installing Ubuntu 18 in new desktop with i7 and 24gb ram . We try to move our android studio project to new pc in zip format and our project work fine on old pc but it showing error on new pc .
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:app:transformNativeLibsWithStripDebugSymbolForDebug’. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:745) Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process ‘command ‘/home/developer/Android/Sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/mips64el-linux-android-strip» at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:220) at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204) at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:340) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86) at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39) . 6 more Caused by: net.rubygrapefruit.platform.NativeException: Could not start ‘/home/developer/Android/Sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/mips64el-linux-android-strip’ at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27) at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68) . 7 more Caused by: java.io.IOException: Cannot run program «/home/developer/Android/Sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/mips64el-linux-android-strip» (in directory «/home/developer/Documents/working_app/valyangadi_firebase_project/app»): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) . 9 more Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(UNIXProcess.java:247) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) . 10 more
What is this errors and How to solve this problem? This project works fine on my old laptop Ubuntu 14.04 LTS that using android studio 3.0
Источник
Hadoop Streaming — Unable to find file error
I am trying to run a hadoop-streaming python job.
I made sure mapper.py has all the permissions. It errors out saying
I tried copying mapper.py to hdfs and give the same hdfs://localhost/mapper.py link, that does not work too! Any thoughts on how to fix this bug?.
8 Answers 8
Looking at the example on the HadoopStreaming wiki page, it seems that you should change
since «shipped files go to the working directory». You might also need to specify the python interpreter directly:
Your problem most likely is that python executable does not exist on the slaves (where TaskTracker is running). Java will give the same error message.
Install it everywhere where it’s used. Un your file you can use shebang as you probably already do:
Make sure that the path after the shebang is the same where python is installed on the TaskTrackers.
One other sneaky thing can cause this. If your line-endings on the script are DOS-style, then your first line (the «shebang line») may look like this to the naked eye:
but its bytes look like this to the kernel when it tries to execute your script:
It’s looking for an executable called «/usr/bin/pythonr» , which it can’t find, so it dies with «No such file or directory» .
This bit me today, again, so I had to write it down somewhere on SO.
I ran into the exact same issue on a CDH4 Hadoop cluster trying to run a streaming python job. The trick is to add in your mapper / reducer file as the first lines:
This will make python look in the current working directory and it should then be able to run, also make sure that your shebang is correct.
I have faced same issue while running map reduce with python code. Solution is: We have to specify «-file» as well in front of mapper and reducer.
Here is the command:
Does your mapper.py have execute permission on it ? If not then you need it.
Hadoop forks and runs the the script before it writes/reads to std so you need to give it execute permission to run.
I just received the same error when my mapper returns a null or empty string. So I had to do a check for the value:
File not found error sometimes does not means «File not found», instead it means «Cannot execute this script».
Knowing this I solved problems like this, when you are facing with issues ( no java ) on streaming I suggest you to follow this check list:
- Does the scripts run? Don’t start is using the interpreter i.e. python myScript.py make it executable at start it as ./myScript.py this is the way the streaming will call your script.
- use -verbose to see what is going into the jar which will be deployed into the container, sometime this help.
- Inside the containers scripts are symlink not real files.
- Files which are moved using -file are not in folders. -mapper folder/script.py or -reducer folder/script.py are treat as script.py
- Containers and anything inside them are deleted after the job completes, if you want to see what is happening into a container move it into HDFS, I.E: replacing the mapper or the reducer with a .sh script which does the work.
This checklist helped me a lot, I hope can be useful also for you.
Here follows the classic log with the ambiguous error message.
It’s true, it cannot run the program.
It’s the reason the lie.
It’s a lie, file does exists if -verbose shows it into the packaging list.
Источник
Caused by: java.io.IOException: error=2, No such file or directory
In a refreshing mindset, recently upgraded Android studio to Android Studio 3.1.2. After the upgrade, the project suddenly failed to compile and run properly.
:app:transformNativeLibsWithStripDebugSymbolForDebug
Caused by: java.io.IOException: error=2, No such file or directory
Detailed error reporting information:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:745) Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/Users/yang/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip'' at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:220) at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204) at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:340) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86) at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39) ... 6 more Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/Users/yang/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip' at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27) at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68) ... 7 more Caused by: java.io.IOException: Cannot run program "/Users/yang/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip" (in directory "/Users/yang/AndroidStudioProjects/VPOS/app"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) ... 9 more Caused by: java.io.IOException: error=2, No such file or directory 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.ProcessBuilder.start(ProcessBuilder.java:1029) ... 10 more
Problem analysis:
Look at the last error message:
Caused by: java.io.IOException: error=2, No such file or directory 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.ProcessBuilder.start(ProcessBuilder.java:1029) ... 10 more
java IO exception, no file or directory was found. Generally speaking, there is a lack of documentation in reporting such problems. Since there is a lack of files, let’s look up and see which files or directories are missing and find the path.
/Users/yang/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip
Let’s follow this path to see if there is really a lack of this file or directory:?
/Users/yang/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/
The above directory lacks files, only to the level of. / prebuild / darwin-x86_64/ and. / prebuild / darwin-x86_64 / bin / mips64el-linux-android-strip
This directory is a tool chain for ndk precompiled so files that are precompiled to mips CPU instruction sets.
We see that the version of NDK in Android SDK is 17.0.4754217, the latest. We assume that Google deleted support for precompilation of mips instruction set CPU in the new version of NDK.
Let’s look for the old version of NDK file and see if there is a complete mips tool chain file in this directory. Download the old version of NDK file from here:?
https://developer.android.com/ndk/downloads/older_releases
We downloaded the previous version 16b, downloaded and decompressed, and went to the same path to see, the files are complete:
At this point, we found the reason for the problem. In the new version 17.0.4754217 NDK, Google deleted the support for CPU precompilation of MIPS instruction set, and when precompiling projects with so files with mips, it would report a missing file or directory error.
Solution:
The first is:
The simplest method is to configure packing parameters in gradle files, excluding all so files under / mips64 / and / mips / files when packaging.
android { ... packagingOptions { exclude 'lib/mips64/*.so' exclude 'lib/mips/*.so' } }
Second species:
Delete all so files under / mips64 / and / mips / files
Third species:
Return NDK in SDK to 16b version and download the 16b version of NDK file here.
https://developer.android.com/ndk/downloads/older_releases
After decompression, replace the ndk-bundle file in the original SDK, that is,…/Android/sdk/ndk-bundle/
Or copy the decompressed…/prebuild/darwin-x86_64/, so that the 17 version of ndk also has the ability to pre-compile mips so files.
Reference resources:
https://stackoverflow.com/questions/50253566/after-using-android-studio-3-1-2-it-showing-error-2-no-such-file-or-directory
https://stackoverflow.com/questions/50300179/gradle-build-fails-following-update-of-android-studio-to-3-1-2
java.io.IOException: error=2, No such file or directory in mac OSX
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Hi,
I am trying to run a node.js script from java. And the following is my source code:
In doing so, i get an error java.io.IOException: error=2, No such file or directory
What am I doing wrong here?
Any help?
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
My guess is that you want to run a script, which is not runnable alone, but only in conjunction with the shell executable.
The shell program could be bash or whatnot — I do not know mac OSX.
Marshal
Posts: 77298
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Have you any idea which file doesn’t exist?
I shall move this thread, because it is too difficult for “beginning”.
Balkishore pandey
Greenhorn
Posts: 19
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Hi,
Thanks a ton for replying.
The file exists. When I type the same on terminal, the file executes.
Ivan Jozsef Balazs
Rancher
Posts: 1043
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
What do you type in on the terminal in order to run it?
What is the file? A script or an executable? I maintain my first guess.
Balkishore pandey
Greenhorn
Posts: 19
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Hi,
It is a script. A javascript file. Inorder to run it in terminal. I usually goto to the folder where the file exist and type
node is also set as environment variable.
Thanks for the help.
Ivan Jozsef Balazs
Rancher
Posts: 1043
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
I see.
You could try «node» with its full path name.
Balkishore pandey
Greenhorn
Posts: 19
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
How should I do that by the way??
Ivan Jozsef Balazs
Rancher
Posts: 1043
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
I assume «node» is a program picked by the command prompt. It must reside somewhere like /opt/where/ever/utils/node, so you can use the full path name.
Just a wild guess though.
Under Linux I’d use «type» or «which» to locate «node».
oracle@izsak:/tmp> type bash
bash is /bin/bash
oracle@izsak:/tmp> which bash
/bin/bash
Balkishore pandey
Greenhorn
Posts: 19
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Hi,
Node resides in /usr/local/bin/node, but what will I do with it??
when I type
master1:~ kishore$ node /Users/kishore/Desktop/serialport/listport.js
on my terminal, the script runs.
So I decided to copy this file where my netbeans project folder resides, (i.e) my user directory and did something like:
String directory = System.getProperty(«user.dir» + «/listport.js»);
System.out.println(directory);
And got the output as null. So my concern is how can I store the path in a string along with the filename?
Bartender
Posts: 3323
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
That should be:
Ivan Jozsef Balazs
Rancher
Posts: 1043
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Balkishore pandey wrote:Hi,
Node resides in /usr/local/bin/node, but what will I do with it??
Use «/usr/local/bin/node» instead of plain «node».
Balkishore pandey
Greenhorn
Posts: 19
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Thanks a lot.
Balkishore pandey
Greenhorn
Posts: 19
posted 10 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
Thanks a lot mate. Using «/usr/local/bin/node » solved the issue.
posted 9 years ago
-
Number of slices to send:
Optional ‘thank-you’ note:
I know this is probably just test code, but nonetheless, let me tell ya Adding a Throws declaration to the main method is terrible idea, because if it does throw an IO exception, it will be sent to the JVM itself, and you will never be able to handle it.
-ben