- Forum
- The Ubuntu Forum Community
- Ubuntu Specialised Support
- Ubuntu Servers, Cloud and Juju
- Server Platforms
- [SOLVED] Unable to access jarfile
-
Unable to access jarfile
I’m currently running Ubuntu on my server and wanting to run a Minecraft modded server for me and my mates. I’ve done this before multiple times but for some reason when I do it now I keep getting the message «Unable to access jarfile»
I’ve tried fixing this by changing the name and directory and ensuring that I’ve typed it correctly. I’ve also tried changing it fromCode:
sudo java -Xms4G -Xmx4G -jar forge-1.8.9-11.15.1.1722-installer nogui
to
Code:
java -jar /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar
. I’ve also tried doing
Code:
sudo chown -R $thomas:$thomas ~
but no matter anything i do i just can’t get it to work.
-
Re: Unable to access jarfile
Thread moved to Server Platforms.
-
Re: Unable to access jarfile
Originally Posted by ghostbacon
I keep getting the message «Unable to access jarfile»
Code:
java -jar /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar
I don’t know anything about the specifics of running this particular jar, but I do know something about what is needed for java to execute a jar. If the above command is giving you the above message (or more precisely «Error: Unable to access jarfile /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar») then there are 2 possible causes:
1. The file does not exist (e.g. perhaps it should be minecraft not minecraf or perhaps there’s a lowercase/uppercase inaccuracy)
or 2. You do not have read access to it.Note that if the jar exists but is corrupt or in some other way invalid, or there are missing dependencies, you will get a different message. What do you get from the following?
Code:
ls -l /home/thomas/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar
-
Re: Unable to access jarfile
It turns out I did, in fact, spell Minecraft incorrectly although now running this I get the response
Code:
A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:62) at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:31) Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') at net.minecraft.launchwrapper.Launch.<init>(Launch.java:34) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) ... 6 more
-
Re: Unable to access jarfile
-
Re: Unable to access jarfile
Make sure whatever version of OpenJDK or Oracle Java you use is compatible with Minecraft 1.8 (which is what Forge 1.8 is based on)
My guess would be Java 1.8 flavor but I could be wrong.
-
Re: Unable to access jarfile
It seems I’ve already got Java 8
-
Re: Unable to access jarfile
Originally Posted by ghostbacon
It seems I’ve already got Java 8
That is surprising because the ClassLoader error you are getting is precisely what you would get when running some Java 8 code from Java 9 or above. The issue is explained here. Note in particular the quotation from the Java 9 release notes.
If you are actually running the jar with Java 8, then I’m afraid I’ve no idea how you would be getting that error.
-
Re: Unable to access jarfile
Update: I decided to uninstall Java and reinstall Java 8, having done this It’s seemed that I’ve completely broken Java as no matter how many times I do it, «java» is not a recognized command. When doing «sudo update-alternatives —config java», I’m returned with «update-alternatives: error: no alternatives for java».
-
Re: Unable to access jarfile
The built-in runtime packages for OpenJDK in Ubuntu are:
Code:
sudo apt install openjdk-8-jre-headless
and
Code:
sudo apt install openjdk-11-jre-headless
To install Oracle Java 8, you need to add their repository, then update and install the runtime:
Code:
sudo add-apt-repository ppa:webupd8team/java sudo apt update sudo apt install oracle-java8-installer
If you have mutliple versions of java installed, you use this command to show/set which java is default when you just type «java»
Code:
sudo update-alternatives --config java
Or you could just specify the path to «java» when you are running the program such as:
Code:
/usr/lib/jvm/java-8-oracle/jre/bin/java -jar /home/thomasthetrain/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar
or
Code:
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/thomasthetrain/Downloads/minecraf/forge-1.8.9-11.15.1.1722-installer.jar
Just make sure you use the path that is setup on your system….rather than copy/paste what I have typed…which may not be accurate to your system.
LHammonds
Bookmarks
Bookmarks

Posting Permissions
If you have recently tried to open a JAR package file, only to receive the error, “unable to access Jarfile,” this simply means that your computer either doesn’t have the right software to open the file, or you have the wrong file path. Other common reasons for getting this error is if you have an outdated version of Java, your computer is infected with malware, or the default program for opening your JAR files isn’t set correctly. Before we jump into the solutions for this, let’s take a look at what JAR is.
Understanding JAR Package Files
Java Archive or JAR is a package file format based on ZIP architecture. It is used to group together multiple Java class files, their metadata, and any resources these files need to run into one single package. The purpose of doing this is to then distribute the grouped files as needed for the running of applications and programs. In order to run the executable file in a JAR package, you must have the latest Java Run-Time Environment installed.
If you are getting the error, “unable to access Jarfile” it means that you are encountering one of the following problems:
- Your system has malware that is either preventing the Jarfile package to open.
- The Jarfile package is corrupted from malware.
- You do not have the latest Java Run-Time Environment installed.
- The default program for accessing JAR files isn’t set.
- The file path for the executable Jarfile package is incorrect.
The “unable to access Jarfile” error is quite a common one since there are many popular programs that use Java as their programming language. For instance, Netflix uses it along with Python for applications in its back-end, while Spotify uses it to stabilize data transfer, and Minecraft uses it for its launcher. Other popular programs and services that use Java include: Uber, Amazon, LinkedIn, Google, and Android OS.
1. Update Your Java to the Latest Version
The most likely reason that you are getting the, “unable to access Jarfile” error is due to an outdated version of Java. Unfortunately, outdated versions of Java Run-Time Environment are prone to security risks and loopholes, so keeping it updated is highly recommended regardless of whether you are getting the above error.
- In your computer’s search menu, type in “Control Panel”.
- In the control panel window, choose “uninstall a program” under programs.
- In the list of programs, scroll until you see Java. Or use the search program box in the top right-hand corner of the window.
- Take a look at the version number and see if it matches the latest release.
- If it doesn’t, uninstall the program by right-clicking on it.
- Choose “yes” when prompted.
- From the official Java website, download the latest version.
- Once downloaded, use the setup wizard to install Java.
Now, re-try opening your JAR package to see if the problem is fixed.
2. Make Java the Default Program for Opening JAR Packages
If you are still getting the “unable to access Jarfile” error after updating your Java Run-Time Environment to the latest version, then you may not have Java set as the default program to use for opening JAR packages.
- In your computer’s taskbar, open File Explorer.
- Find the folder that contains your JAR package.
- Right-click on the folder and choose “open,” and then Java.
- If Java is not listed, select “choose another app”.
- In the window that pops up, choose Java from the list. If it is not there, choose the “look for another app on this PC” option.
- Browse your computer for Java and find the program. Select it and hit the “open” option.
- A prompt window may open. If it does, choose “okay” and “open”.
- Double-click on your JAR package executable to open.
When browsing for Java on your computer in step 6, the most common place for it to be is in Program Files (x86)/Java/Java <Version>/Bin/Java.exe. Keep in mind that Java is usually installed to the default hard drive disk where your operating system is, unless you do a custom installation path. So, keep this in mind when trying to find Java on your computer.
3. Set Java as a Default Association Permanently
If you use a lot of programs or applications that use the Java Run-Time Environment, it is recommended that you set Java as a default association permanently in your computer, so that any JAR packages or files are automatically opened by Java.
- Press the Windows key and “I” on your keyboard to open Settings. Alternatively, type “settings” into your computer’s search menu.
- Click into the “apps” option in the Settings window.
- Choose “default apps” in the left-hand sidebar.
- Scroll until you see, “choose default apps by file type” and click it.
- Now, look for .jar in the list and click on “Choose a default” next to it.
- Find the Java Platform Program (Java Run-Time Environment) on your computer.
- Save the changes and exit.
Now restart your computer for the changes to take effect and see if you can open your JAR package without the, “unable to access Jarfile” error.
4. Check for Malware to Eliminate Infections Causing Trouble
If you are still getting the “unable to access Jarfile” error, it may be from malicious malware. A virus can easily exploit your registry and modify it to make JAR packages unusable. It is highly recommended that you run a thorough scan of your entire computer to look for malware. If you find some, remove it and uninstall Java. Repeat fix 1 in this list to reinstall.
5. Configure Hidden Files/Folders/Drives to Show
While not as common, sometimes hidden files, folders, and drives can cause the “unable to access Jarfile” error.
- In your computer’s taskbar, open File Explorer.
- At the top of the window, click on the “View tab”.
- Now click on the “Options” button to the far right.
- In the new window that opens, click on the “View tab” again.
- In the list, choose the “Show hidden files, folders, and drives” option.
- Hit Apply and then hit OK.
6. Repair Your Java Programs with Jarfix.
If you are using programs that launch with Java and they are not responding to you, no matter how many times you try to open the application, then it may be time to repair your JAR associations. To do this, simply download Jarfix, a lightweight program that fixes hijacked JAR associations, and run it.
7. Check the Documentation If You Are a Developer
If you are working in Java as a developer and come across the “unable to access Jarfile” error, it is likely that there is a minor mistake within the coding. It is recommended that you go back through and re-read to make sure that you have the right file path and the correct parameters for the code to work. Depending on what utility you are using to open and run your JAR packages, you may need to go back through and re-read the documentation on how to get it functioning properly.
Wrapping It Up
In most cases, the “unable to access Jarfile ” error will be solved by updating your Java Run-Time Environment to the latest version, but if it doesn’t solve the problem, please do try out the other methods on this list. Let us know in the comments below if we were able to help you!
Как правильно задавать вопросы
Правильно сформулированный вопрос и его грамотное оформление способствует высокой вероятности получения достаточно содержательного и по существу ответа. Общая рекомендация по составлению тем: 1. Для начала воспользуйтесь поиском форума. 2. Укажите версию ОС вместе с разрядностью. Пример: LM 19.3 x64, LM Sarah x32 3. DE. Если вопрос касается двух, то через запятую. (xfce, KDE, cinnamon, mate) 4. Какое железо. (достаточно вывод inxi -Fxz
в спойлере (как пользоваться спойлером смотрим здесь)) или же дать ссылку на hw-probe 5. Суть. Желательно с выводом консоли, логами. 6. Скрин. Просьба указывать 2, 3 и 4 независимо от того, имеет ли это отношение к вопросу или нет. Так же не забываем об общих правилах Как пример вот
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск .jar-файла
25 сен 2017, 19:16
1) Linux Mint 18.1 32-bit
2) Cinnamon
4)Здравствуйте, не могу открыть программу, на сайте от куда я ее скачал сказано что, в первый раз надо запустить от пользователя root (как войти в пользователь я знаю).
попробовал команду:
вот ответ терминала:
Код: Выделить всё
ubuntu-HP-Compaq-8100-Elite-CMT-PCubuntu # sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar
Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar
не сработало
ВСЕМ БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!!! _________________________ ВСЕМ БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!!!
-
symon2014
Запуск программы
#2
25 сен 2017, 19:25
tortik писал(а): # sudo
Для начала, ты уже в руте .
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск программы
#3
25 сен 2017, 19:35
спасибо но проблемы не решает
-
Chocobo
- Сообщения: 9954
- Зарегистрирован: 27 авг 2016, 22:57
- Решено: 214
- Откуда: НН
- Благодарил (а): 795 раз
- Поблагодарили: 2980 раз
- Контактная информация:
Запуск программы
#4
25 сен 2017, 19:53
tortik, Укажи абсолютный путь к файлу
sudo java -jar /path/to/file.jar
или укажи что он находится в текущей директории
cd /path/to/
sudo java -jar ./file.jar
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск программы
#5
25 сен 2017, 20:25
спасибо за помощь, но терминал отнекивается:
Код: Выделить всё
sudo java /home/ubuntu/Downloads/cXPBootstrap-1.1.0-SNAPSHOT-production.jar
Error: Could not find or load main class .home.ubuntu.Downloads.cXPBootstrap-1.1.0-SNAPSHOT-production.jar
-
connor41
- Сообщения: 270
- Зарегистрирован: 13 июл 2017, 02:19
- Решено: 1
- Благодарил (а): 71 раз
- Поблагодарили: 34 раза
- Контактная информация:
Запуск программы
#6
25 сен 2017, 20:30
tortik, напиши не просто java, а java с ключем -jar … java -jar
Приложения лучше не запускать от рута «sudo», если они того не требуют.
.jar файлы ты можешь спокойно открывать двойным щелчком мыши, если программа для открытия по умолчанию установлена JVM
Arch Linux and Linux mint User
4.14.13-1-zen
i3wm
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск программы
#7
25 сен 2017, 20:44
При открытии jar файла программа запускается но компьютер говорит что нет прав. Говорит что надо открыть от пользователя root и закрывает программу.
напиши не просто java, а java с ключем -jar … java -jar
тогда получатся два раза подряд java
(попробовал не получилось)
БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!!! (и извини за вредный компьютер)
-
rogoznik
- Сообщения: 9443
- Зарегистрирован: 27 июн 2017, 13:36
- Решено: 119
- Откуда: Нижний Тагил
- Благодарил (а): 715 раз
- Поблагодарили: 1816 раз
-
Контактная информация:
Запуск программы
#8
25 сен 2017, 20:52
java -jar file.jar
находясь в папке с файлом
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск программы
#9
25 сен 2017, 21:05
нет не сработало.
БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ
-
rogoznik
- Сообщения: 9443
- Зарегистрирован: 27 июн 2017, 13:36
- Решено: 119
- Откуда: Нижний Тагил
- Благодарил (а): 715 раз
- Поблагодарили: 1816 раз
- Контактная информация:
Запуск программы
#10
25 сен 2017, 21:07
tortik писал(а): нет не сработало.
подробнее пожалуйста. Вывод из терминал вместе с командой которую набрал покажи
-
symon2014
Запуск программы
#11
25 сен 2017, 21:09
sudo java -jar ~/Downloads/cXPBootstrap-1.1.0-SNAPSHOT-production.jar
так попробуй
-
Chocobo
- Сообщения: 9954
- Зарегистрирован: 27 авг 2016, 22:57
- Решено: 214
- Откуда: НН
- Благодарил (а): 795 раз
- Поблагодарили: 2980 раз
- Контактная информация:
Запуск программы
#12
25 сен 2017, 21:12
А с чем мы хоть дело кстати имеем?
tortik, Покажи еще и java -version
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск программы
#13
25 сен 2017, 21:53
Symon2014:не сработало. БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ
Сhocobo:
java version «1.8.0_144»
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) Server VM (build 25.144-b01, mixed mode)
А с чем мы хоть дело кстати имеем?
думаю разницы не будет, но что именно сказать? приложение официальное
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск программы
#14
25 сен 2017, 21:58
darkfenix: sudo java -jar файл.jar
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск программы
#15
25 сен 2017, 22:23
Всем большое спасибо отвечу завтра
-
di_mok
- Сообщения: 5439
- Зарегистрирован: 27 авг 2016, 19:06
- Решено: 32
- Откуда: Арзамас
- Благодарил (а): 1569 раз
- Поблагодарили: 1262 раза
- Контактная информация:
Запуск программы
#16
26 сен 2017, 01:00
tortik, проблема таится в том, что ты запускаешь из сеанса суперпользователя. Просто запусти от обычного пользователя sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar
и всё заработает
Настоящая водка — это не пьянство, а ключ к своей совести, с нее-то и начинается настоящая мудрость. (c)
-
rogoznik
- Сообщения: 9443
- Зарегистрирован: 27 июн 2017, 13:36
- Решено: 119
- Откуда: Нижний Тагил
- Благодарил (а): 715 раз
- Поблагодарили: 1816 раз
- Контактная информация:
Запуск программы
#17
26 сен 2017, 09:04
tortik писал(а): darkfenix: sudo java -jar файл.jar
А что в ответ получил?
-
tortik
- Сообщения: 9
- Зарегистрирован: 25 сен 2017, 18:42
- Благодарил (а): 8 раз
- Контактная информация:
Запуск .jar-файла
#18
26 сен 2017, 18:32
darkfeni:
ubuntu-HP-Compaq-8100-Elite-CMT-PCubuntu # sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar
Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar
di_mok: вот ответ терминала:
Код: Выделить всё
ubuntu@ubuntu-HP-Compaq-8100-Elite-CMT-PC ~ $ sudo java -jar cXPBootstrap-1.1.0-SNAPSHOT-production.jar
[sudo] пароль для ubuntu:
Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar
БОЛЬШОЕ СПАСИБО ЗА ПОМОЩЬ!
-
Chocobo
- Сообщения: 9954
- Зарегистрирован: 27 авг 2016, 22:57
- Решено: 214
- Откуда: НН
- Благодарил (а): 795 раз
- Поблагодарили: 2980 раз
- Контактная информация:
Запуск .jar-файла
#19
26 сен 2017, 18:37
Я конечно не спец в java, но нагуглил тут хелловорлд, для проверки
Код: Выделить всё
chocobo@lmde:~/java$ ls -l
итого 12
-rw-r--r-- 1 chocobo chocobo 426 сен 26 18:02 HelloWorld.class
-rw-r--r-- 1 chocobo chocobo 779 сен 26 18:03 HelloWorld.jar
-rw-r--r-- 1 chocobo chocobo 117 сен 26 18:02 HelloWorld.java
chocobo@lmde:~/java$ java -jar HelloWorld.jar
Hello World!
tortik, Вот здесь ты запускаешь его из домашнего раздела. А сам файлик именно там и лежит?
покажи ls -l ~/cXPBootstrap-1.1.0-SNAPSHOT-production.jar
-
rogoznik
- Сообщения: 9443
- Зарегистрирован: 27 июн 2017, 13:36
- Решено: 119
- Откуда: Нижний Тагил
- Благодарил (а): 715 раз
- Поблагодарили: 1816 раз
- Контактная информация:
Запуск .jar-файла
#20
26 сен 2017, 19:08
Chocobo, тут спецом в java и не надо быть.
Судя по этому:
tortik писал(а): Error: Unable to access jarfile cXPBootstrap-1.1.0-SNAPSHOT-production.jar
у меня подозрения на отсутствие вообще каких-либо прав доступа к этому файлу.
Вернуться в «Иное программное обеспечение»
Перейти
- Новости
- ↳ Новости Linux Mint
- ↳ Другие новости
- Документация, FaQ и Видеоматериалы
- ↳ Руководства
- ↳ Руководство пользователя LM 18 Cinnamon
- ↳ Видеоматериалы
- ↳ Вопрос новичка и FaQ
- Установка, настройка, оптимизация
- ↳ Установка Linux Mint
- ↳ Загрузка системы, бэкапы и восстановление
- ↳ Параметры и оптимизация
- ↳ Иные системные ошибки
- ↳ Неофициальные сборки
- ↳ Общие вопросы по системе
- Дистрибутивы
- ↳ Linux Mint
- ↳ Cinnamon
- ↳ Mate
- ↳ Xfce
- ↳ KDE
- ↳ Другие среды рабочего стола
- ↳ LMDE
- Программное обеспечение
- ↳ Мультимедиа
- ↳ Офис и документы
- ↳ Системные утилиты
- ↳ Консольные плюшки
- ↳ Программирование, скриптинг, виртуализация
- ↳ Работа с сетью
- ↳ Безопасность
- ↳ Wine
- ↳ Игры
- ↳ Иное программное обеспечение
- Поддержка железа
- ↳ Видеокарты
- ↳ Звуковые карты
- ↳ Принтеры, Сканеры, МФУ
- ↳ Жесткие диски, SSD, Flash-накопители, разделы на них
- ↳ Сетевые карты, модемы, Wi-Fi, bluetooth
- ↳ Прочие устройства
- Другие дистрибутивы
- ↳ Deb-based [Debian / Neon / Ubuntu]
- ↳ Arch-based [Arch / Manjaro / Antegros]
- ↳ Rpm-based [Suse / Fedora / CentOS]
- ↳ Прочие [Gentoo/Slackware/*BSD]
- Разное
- ↳ Болталка: Оффтоп, разбор полетов
- ↳ Песочница
- ↳ Корзина
Кто сейчас на конференции
Сейчас этот форум просматривают: нет зарегистрированных пользователей и 0 гостей