Java io ioexception no such file or directory linux

java.io.IOException: error=2, No such file or directory #1

Comments

grvhi commented Oct 22, 2014

@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:

grvhi commented Oct 22, 2014

If anyone comes along later, the path is (or can be) absolute. And to daemonize, look no further than supervisord

knorwood commented Oct 22, 2014

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.

grvhi commented Oct 22, 2014

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.

Tenzer commented Oct 30, 2014

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.

Читайте также:  Принтер hp laserjet 3055 драйвер для windows 10

sid137 commented Oct 30, 2014

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

Tenzer commented Oct 30, 2014

@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?

sid137 commented Oct 30, 2014

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)
.

knorwood commented Oct 30, 2014

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.

Источник

Не удается сделать файл java.Ио.IOException: нет такого файла или каталога

Я пытаюсь создать файл в файловой системе, но я постоянно получаю это исключение:

у меня есть существующий каталог, и я пытаюсь записать файл в этот каталог.

у меня есть разрешение на запись в путь, но файл не создается.

8 ответов

распечатайте полное имя файла или выполните шаг в отладчике. Когда я запутываюсь в таких ошибках, это означает, что мои предположения и ожидания не соответствуют реальности. Убедитесь, что вы можете посмотреть что такое путь; это поможет вам понять, где вы ошиблись.

Если каталог ../.foo/bar/ не существует, вы не можете создать файл там, поэтому убедитесь, что вы сначала создаете каталог.

попробуйте что-то вроде этого:

будьте осторожны с разрешениями, вероятно, у вас нет некоторых из них. Вы можете увидеть его в настройках — > приложения — > имя приложения — > разрешения — > активный, если нет.

вы можете использовать Apache Commons IO ‘ s пакета fileutils.openOutputStream(файл) метод. Он имеет хорошие сообщения об исключениях, когда что-то пошло не так, а также создает необходимые родительские каталоги. Если все было правильно, вы сразу получаете свой OutputStream-очень аккуратно.

Если вы просто хотите файл FileUtils.touch(File) вместо.

File.isFile() is false если файл / каталог не существует, поэтому вы не можете использовать его для проверки того, пытаетесь ли вы создать каталог. Но это не первый вопрос.

Читайте также:  Windows обновить кеш иконок

проблема в том, что промежуточные каталоги не существуют. Вы хотите позвонить f.mkdirs() первый.

У меня такая же проблема при использовании rest-easy. После поиска, пока я понял, что эта ошибка произошла, когда нет места сохранить временные файлы. Поэтому в tomcat вы можете просто создать tomcat-root / temp.

я исправил свою проблему с помощью этого кода в файловой системе linux

Источник

Caused by: java.io.IOException: error=2, No such file or directory

In the spirit of early adopters, recently Android studio Upgraded to Android Studio 3.1.2 After the upgrade, the project suddenly failed to compile and run normally, reported:

Caused by: java.io.IOException: error=2, No such file or directory

Detailed error information:

problem analysis:

See the error message in the last paragraph:

The java IO is abnormal and the file or directory cannot be found. This kind of problem is usually reported as missing documents. Since it is missing files, let’s look up and see which files or directories are missing and find this path:

Based on this path, let’s see if this file or directory is really missing:

There are missing files in the above directory, only to . /prebuilt/darwin-x86_64/ This level is missing . /prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip

This directory is a tool chain for ndk pre-compilation, used to pre-compile the so file with mips CPU instruction set.

We see that the version of ndk in the Android SDK is 17.0.4754217 ,Newest. We suspect that Google has removed support for mips instruction set CPU precompilation in the new version of the NDK.

We look for the old version of the NDK file to see if there is a complete mips toolchain file in this directory. Download the old version of the NDK file from here:
https://developer.android.com/ndk/downloads/older_releases

We download the last version 16b, after downloading and decompressing, go to the same path to see, the files are complete:

So far we have found the cause of the problem, Google in the new version 17.0.4754217 In the NDK, the support for mips instruction set CPU precompilation has been removed. When precompiling projects with mips so files, an error of missing files or directories will be reported 。

Solution:

The first:

This method is the simplest, configure packaging parameters in the gradle file, and exclude when packaging /mips64/ with /mips/ All so files under the file.

The second kind:

delete /mips64/ with /mips/ All so files under the file

The third kind:

Roll back the NDK in the SDK to the 16b version, go here to download the 16b version of the ndk file
https://developer.android.com/ndk/downloads/older_releases

After decompression, replace the ndk-bundle file in the original SDK, ie . /Android/sdk/ndk-bundle/

Or the unzipped . /prebuilt/darwin-x86_64/ , Copy the past, so the 17 version of ndk also has the ability to pre-compile mips so files

Источник

Java, вызвано: java.io.IOException: error = 2, нет такого файла или каталога

Привет, у меня есть странная проблема при выполнении команды с использованием Java. Я использовал следующий код для запуска команды, если я запускаю mkdir testFolder , программа запускается успешно, но если я изменил команду как yarn -v тогда ошибка случится.

Читайте также:  Install windows from ubuntu terminal

P / s: в режиме отладки: IntelliJ мог работать выше кода, но Netbeans не удалось.

В рабочем режиме (файл JAR): IntelliJ тоже не удалось.

Изменить 2 .

Я обнаружил, что если я запускаю команду из /bin или /usr/bin , код выполняется нормально (pwd, mkdir, java -version . ), но пряжа находится в /usr/local/bin/ , так что это не сработало, и я до сих пор не знаю, как это исправить.

4 ответа

Я наконец-то нашел ответ, потому что процесс, который я запускаю, отличается от процесса в терминале, поэтому не могу получить доступ к / usr / local / bin, нужно добавить -l для запуска команды как зарегистрированный пользователь. Runtime.getRuntime().exec(new String[]<"bash", "-l", "-c", cmd>, null, new File(f))

Поскольку error код 2 предполагает, что вы указали неверный путь. Код ошибки соответствует POSIX ENOENT и «Нет такого файла или каталога» в его представлении char * strerror(int errno) .

Чтобы самостоятельно устранить проблему, вы можете прочитать страницу руководства http: // man7.org/linux/man-pages/man2/execve.2.html

Файл с именем файла или сценария или интерпретатора ELF не существует, или не найдена общая библиотека, необходимая для файла или интерпретатора.

Чтобы увидеть, с какого конкретного пути запущен ваш процесс, запустите Java с strace -f

Источник

java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program «dot»: error=2, No such file or directory #469

Comments

winddd commented Jul 8, 2020 •

I am trying to run the stolon test and it can complete all the read and append transactions. But during analyzing period, one problem occurs. Here is the stack trace:

OS of control node: Debian 9.
OS of db node: Debian 10.
gnuplot version: gnuplot 5.0 patchlevel 5.

The text was updated successfully, but these errors were encountered:

aphyr commented Jul 8, 2020

Like the error message says, you don’t have dot installed—you’ll need graphviz for Jepsen to render the anomalies.

winddd commented Jul 8, 2020 •

wow, I didn’t realize that dot is a library. Thank you!

aphyr commented Jul 8, 2020

In your defense, the documentation for this is basically nonexistent! That’s on me, sorry!

winddd commented Jul 8, 2020 •

In your defense, the documentation for this is basically nonexistent! That’s on me, sorry!

I have successfully reproduced the phenomenon of G2-item after several days’ try. I am so excited! Thanks a lot for your help!

winddd commented Jul 8, 2020

In your defense, the documentation for this is basically nonexistent! That’s on me, sorry!

ah, I learnt the Jepsen from the etcd tutorial and it is based on the old version(may be before 0.18.0). It seems that Jepsen underwent a big refactoring/update after that. By the way, wish to see the updated tutorial for the redesigned Jepsen if possible.

aphyr commented Jul 8, 2020

Yeah, that would be great. I’m. still trying to summon up the wherewithal to write any kind of code this week; when I get a free 10 hours or so I’ll go through the tutorial again.

Источник

Оцените статью