Linux unable to access jarfile что делать linux

Arch Linux

You are not logged in.

#1 2020-08-19 10:05:54

[Solved] Unable to access jarfile

Hi
I installed avr8-burn-o-mat 2.1.2-2 from AUR and it works if I start the start.sh file from the console within the same directory.

But I get an error «Error: Unable to access jarfile AVR8_Burn_O_Mat.jar» as soon as I try to run the start.sh file from outside of its directory.

Could it be a problem with the java path?

Thanks for any tips in advance.

Last edited by Eskimo (2020-08-19 14:01:53)

#2 2020-08-19 11:15:50

Re: [Solved] Unable to access jarfile

You didn’t install the package yet.

You need to build and install the AUR package, and then the PKGBUILD will set up the necessary links to /usr/bin so that you can just start it with

Alternatively fix the start.sh and either make the path to the jar file absolute directly or do a cd to the correct dir before the java command is ran. But properly installing the package and then using the relevant /usr/bin link should be preferred.

Last edited by V1del (2020-08-19 11:21:25)

#3 2020-08-19 14:07:24

Re: [Solved] Unable to access jarfile

Thanks for your fast answer.
I did install the package with «makepkg -sri», but I was not able to find out the right command to start the program. I only found the start.sh file.
Your comment about the /usr/bin link brought me on the right track. I do not need the start.sh file. I can start the program directly with the «avr-burn-o-mat» command in /us/share.

I was able now to create the .desktop file for integration into the xfce menu and it works now.

#4 2020-08-19 14:12:43

Re: [Solved] Unable to access jarfile

If you’re unsure about the command any given package is installed under it might help to ask pacman. Directly executable binaries from pacman packages should always be in /usr/bin so you can check the command used for execution with

. or by checking where and under what name the PKGBUILD stores the executable and you should always read PKGBUILDs before installing them into your system

Last edited by V1del (2020-08-19 14:13:58)

Источник

Как сделать архив jar исполняемым в терминале .

постоянно пишет, пробовал разными способами даже в текущей директории .

root@debian:/home/user# chmod ugo+x /home/user/ml.jar chmod: cannot access ‘/home/user/ml.jar’: No such file or directory

root@debian:/home/user# chmod a+rx ml.jar chmod: cannot access ‘ml.jar’: No such file or directory

root@debian:/home/user# java -jar -tf mp.jar Error: Unable to access jarfile mp.jar

ПОМОГИТЕ . . файл ml.jar в директории есть .

А зачем? Чем java -jar не устраивает?

у меня это не работает . смотри: root@debian:/home/user# java -jar ml.jar Error: Unable to access jarfile ml.jar

Jar содержит классфайлы с байткодом который исполняется на jvm. Т.е. как предыдущий комментатор указал запускать нужно java -jar ml.jar

Jar это zip архив, проверь что он не пустой в любом архиваторе понимающим zip или так jar -tf mp.jar[/url]

root@debian:/home/user# java -jar -tf mp.jar Error: Unable to access jarfile mp.jar

Тебе же говорят, нет никакого ml.jar

я понимаю что говорят но у меня ОН ЕСТЬ . в текущей и другой директории .

root@debian:/home/user# chmod ugo+x /home/user/ml.jar chmod: cannot access ‘/home/user/ml.jar’: No such file or directory

root@debian:/home/user# chmod a+rx ml.jar chmod: cannot access ‘ml.jar’: No such file or directory

Читайте также:  Создать bcd файл windows

root@debian:/home/user# java -jar -tf mp.jar Error: Unable to access jarfile mp.jar

файл ml.jar есть

у тебя прав на него может не быть

Во-первых, не работай под рутом, примета плохая.

Во-вторых, ты уж определись как твой файл называется.

И в-третьих, вывод ls действительно покажи, что у тебя там.

вверху все выводы написаны посмотри .

Смотрю. Вывода ls не вижу.

root@debian:/home/user# ls -la ml.jar ls: cannot access ‘ml.jar’: No such file or directory

root@debian:/home/user# ls -la ml.jar ls: cannot access ‘ml.jar’: No such file or directory

тебе английским по белому говорят, что этого файла нет. по крайней мере в этой директории.

Слушай, мы уже поняли что файла ml.jar там нет. Именно поэтому уже пятый раз предлагаем тебе запустить команду ls. Просто ls, без параметров.

root@debian:/home/user# ls Desktop Downloads ml.jar Pictures Templates Documents libflashplayer.so Music Public Videos

что-то я прозреваю какое-то гонево. А если ls -la запустить?

посмотри, как Spring делает исполняемые jar-ники. Там в начале bash-код, а после — сам jar «вписан» в секцию данных.

да не, у него что то странное. по крайней мере на первый взгляд.

ТС, попробуй ls -la как уже сказали и вывод в студию

1) Создать файл stub.sh с таким содержимым:

2) Выполнить код:

где helloworld.jar наш jar-файл, а helloworld.run исполняемый файл

если очень хочется, то можно вообще вывод направить в файл с расширением jar, например, helloworld-executable.jar, и файл будет выполняться как из терминала, так и в среде Windows при помощи java -jar helloworld-executable.jar

ты уверен что ml.jar не директория ?

Введи ls в терминал, затем введи cat ml.jar > /dev/null

Сделай скриншот терминала (убедись что обе команды на скрин попали) и скинь его сюда

На такой тред грех не подписаться

чёт сообщений от anonimussss больше нет.. видать понял масштабы своей одури и повесился..

У меня случай как-то был из этой же серии. ) Сдал постоянному клиенту очередную версию ПО, он её продал в какую-то японскую фирму, ну и через денек-другой дает емелю пользователя и просит разобраться — что-то там никак не конфигурится. А там после развертывания архива с приложением нужно было настроить файл mail.ini. Несколько дней переписывался с японочкой — та утверждала, что все делает по инструкции и правит тот самый файл. В конечном итоге додумался попросить скриншот папки приложения — тут-то меня и осенило ). Судя по картинке, девушка работала со списком файлов в режиме сокрытия расширений файлов и на этой самой картинке почему-то болтался файл main.ini. В общем, выяснилось, что в архиве вместе с файлом main.ini болтался еще файл main.ini.old – его-то она и правила )))

Несколько раз еще сталкивался с ситуациями, когда случайно при создании файлов вбивали в имя файла русские буквы вместо латиницы (е,м,о,в,к) или визуально путали единичку с латинской l (которая L).

Источник

«Невозможно получить доступ к jarfile» в Linux land

у нас есть веб-приложение, работающее под JBoss 5, которое периодически запускает процесс «java» (используя ProcessBuilder) для компиляции файлов в Linux. Процесс работает без проблем на машине разработки Windows и на виртуальной машине Ubuntu, которую мы установили. Команда следующая:

все пути подтверждаются правильными и путь к файлу jar заключен в двойные кавычки. После двух пива и Биг-Мака системный отдел подтвердил, что пользователь (jbossadmin) запуск JBoss также является владельцем файла:

Я подозреваю, что это проблема прав поэтому мы предложили им измените разрешения на выполнение

единственное, о чем я могу думать, это то, что это ошибка перевода пути или что мы не применили право на правильное место!

Edit: отличное предложение Андреа Спадаччини, однако кажется, что у нас уже есть разрешения на обход через путь:

Читайте также:  Как выбрать выборочную установку при установке windows

Edit: С Eva мы можем подтвердить, что выполнение строки через командную строку (bash), что она работает, но она выдает ошибку, если мы выполним строку из класса ProcessBuilder, встроенного в файл jar, в Linux. Так же, как сделал бы наш JBoss. Двойные кавычки параметры являются наиболее вероятной причиной проблемы здесь.

4 ответов

@ian_scho Привет!, Я думаю, проблема здесь в том, что кавычки командной строки разрешены, потому что интерпретируется процессом bash в linux (который является интерпретацией командной строки). Когда класс ProcessBuilder используется внутри кода java, кавычки интерпретируются как часть пути. для этого отображается ошибка «невозможно получить доступ к jarfile». Вы можете увидеть процесс parent с командой ps -adf , попробуйте запустить строку comand в фоновом режиме ( & ) как следуйте:

и затем вызвать команду

вы увидите, что процесс bash является родителем. Если вы сделаете то же самое, когда JBoss работает, вы можете увидеть, что родительский процесс выполнения java-это другой процесс, который не может интерпретировать кавычки.

надеюсь, что это вам поможет:)

проверьте, все ли каталоги, ведущие к файлу JAR, имеют разрешения на чтение и перемещение ( +rx ) для jbossadmin пользователей.

Если вы выполняете команду Java из сценария оболочки, проверьте, что сценарий оболочки имеет Терминаторы строк Linux/Unix, а не Windows, как это может произойти, если сценарий оболочки был создан на платформе Windows. Заявленная ошибка, безусловно, произойдет в этом случае.

используйте редактор Kate в Linux для проверки и исправления или утилиту dos2unix, если она доступна.

перейдите в каталог, где находится файл jar.

Источник

What causes «Unable to access jarfile» error?

I want to execute my program without using an IDE. I’ve created a jar file and an exectuable jar file. When I double click the exe jar file, nothing happens, and when I try to use the command in cmd it gives me this:

I use the command: java -jar Calculator.jar

How I created the jar:

  1. Right click on project folder (Calculator)
  2. Select
  3. Click on Java Folder and select «Exectuable Jar File», then select next
  4. Launch Configuration: Main — Calculator
  5. Create Export Destination
  6. Hit «Finish» and profit! Well, not really.

37 Answers 37

I had encountered this issue when I had run my Jar file as

java -jar TestJar

java -jar TestJar.jar

Missing the extension .jar also causes this issue.

Fixed

I just placed it in a different folder and it worked.

[Possibly Windows only]

Beware of spaces in the path, even when your jar is in the current working directory. For example, for me this was failing:

I was able to fix this by givng the full, quoted path to the jar:

Credit goes to this answer for setting me on the right path.

I had this issue under CygWin in Windows. I have read elsewhere that Java does not understand the CygWin paths ( /cygdrive/c/some/dir instead of C:\some\dir ) — so I used a relative path instead: ../../some/dir/sbt-launch.jar .

I had the same issue when trying to launch the jar file. The path contained a space, so I had to place quotes around. Instead of:

Just came across the same problem trying to make a bad USB.

I tried to run this command in admin cmd

But got this error:

Solution

1st step

Right click the jarfile in question. Click properties. Click the unblock tab in bottom right corner. The file was blocked, because it was downloaded and not created on my PC.

2nd step

In the cmd I changed the directory to where the jar file is located.

Then I typed dir and saw the file was named duckencode.jar.jar

So in cmd I changed the original command to reference the file with .jar.jar

Читайте также:  Windows 10 удаляет файлы kmsauto

That command executed without error messages and the inject.bin I was trying to create was now located in the directory.

Hope this helps.

I had a similar problem and I even tried running my CMD with administrator rights, but it did not solve the problem.

The basic thing is to make sure to change the Directory in cmd to the current directory where your jar file is.

Do the following steps:

Copy jar file to Desktop.

Type command cd desktop

Then type java -jar filename.jar

This should work.

Edit: From JDK-11 onwards ( JEP 330: Launch Single-File Source-Code Programs )

Since Java 11, java command line tool has been able to run a single-file source-code directly. e.g.

If you are using OSX, downloaded files are tagged with a security flag that prevents unsigned applications from running.

to check this you can view extended attributes on the file

You can then clear the attributes with

None of the provided answers worked for me on macOS 11 Big Sur. The problem turned out to be that programs require special permission to access the Desktop, Documents, and Downloads folders, and Java breaks both the exception for directly opened files and the permission request popup.

  • Move the .jar into a folder that isn’t (and isn’t under) Documents, Desktop, or Downloads.
  • Manually grant the permission. Go to System Preferences → Security and Privacy → Privacy → Files and Folders → java, and check the appropriate folders.

This worked for me.

It can also happen if you don’t properly supply your list of parameters. Here’s what I was doing:

Instead of the correct version:

sometime it happens when you try to (run or create) a .jar file under /libs folder by right click it in android studio. you can select the dropdown in top of android stuio and change it to app. This will work

For me it happens if you use native Polish chars in foldername that is in the PATH. So maybe using untypical chars was the reason of the problem.

My particular issue was caused because I was working with directories that involved symbolic links (shortcuts). Consequently, trying java -jar ../../myJar.jar didn’t work because I wasn’t where I thought I was.

Disregarding relative file paths fixed it right up.

In my case the suggested file name to be used was jarFile*.jar in the command line. The file in the folder was jarFile-1.2.3.jar . So I renamed the file to jarFile . Then I used jarFile.jar instead of jarFile*.jar and then the problem got resolved

It can happen on a windows machine when you have spaces in the names of the folder. The solution would be to enter the path between » «. For example:

To avoid any permission issues, try to run it as administrator. This worked for me on Win10.

I know this thread is years ago and issue was fixed too. But I hope this would helps someone else in future since I’ve encountered some similar issues while I tried to install Oracle WebLogic 12c and Oracle OFR in which its installer is in .jar format. For mine case, it was either didn’t wrap the JDK directory in quotes or simply typo.

Run Command Prompt as administrator and execute the command in this format. Double check the sentence if there is typo.

«C:\Program Files\Java\jdk1.xxxxx\bin\java» -jar C:\Users\xxx\Downloads\xxx.jar

If it shows something like JRE 1.xxx is not a valid JDK Java Home , make sure the System variables for JAVA_HOME in Environment Variables is pointing to the correct JDK directory. JDK 1.8 or above is recommended (2018).

Источник

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