Hot answers tagged

182

I ran into this same error on my Ubuntu 15.10 server but did not want to install the non-headless version of OpenJDK due to the number of additional dependencies. A simpler solution was to simply disable assistive technologies. This can be done by editing the accessibility.properties file for OpenJDK 8 (change the version to whichever is actually in use on ...


42

Make sure you're on 14.04. Ubuntu 16.04 (and above) uses systemd, not Upstart. A Upstart script is a script file placed at /etc/init/ and ending in .conf. It requires 2 sections: one to indicate when to start, and another with the command to execute. The easiest script to start with your sample is: # myprogram.conf start on filesystem exec /usr/bin/java -...


32

Read the following thread. I managed to escape this problem by uninstalling OpenJDK 8 headless and installing OpenJDK 8. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798794 Commands I ran: sudo dpkg -l | grep openjdk This is to verify you are actually running the headless version of JAVA, so no graph library available. sudo apt-get remove openjdk-...


15

The dtrx command is your friend on that matter. It uncompresses any archive file by guessing its type. It will also make sure the files you uncompress will be put in a new directory ; avoiding messing up the current working dir with tons of files. Install sudo aptitude install dtrx Usage dtrx stuff.zip


14

You can use the following shell script (I named it extract and I put it in ~/bin): #!/bin/bash if [ $# -lt 1 ];then echo "Usage: `basename $0` FILES" exit 1 fi # I found the following function at https://unix.stackexchange.com/a/168/37944 # which I improved it a little. Many thanks to sydo for this idea. extract () { for arg in $@ ; do if [...


12

For those who do not have root access on their machines to change the configuration file or do not want to install the full JRE: append -Djavax.accessibility.assistive_technologies=" " to your command, e.g. $ java -jar aprof-plot.jar -Djavax.accessibility.assistive_technologies=" " Do note that the " " is important, simply using "nothing" as parameter will ...


7

Same issue. In my case I couldn't run FastQC. This is what I did: $ sudo apt-get remove openjdk-11-jre-headless I verified java was gone $ java -version bash: /usr/bin/java: No such file or directory $ sudo apt-get install openjdk-8-jre Problem solved.


6

You need to do this echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823 sudo apt-get update sudo apt-get install sbt to install sbt


5

When you run your jar using java -jar myfile.jar you're telling your shell to run the java command and passing it some arguments which java understands. However when you're running it using ./myfile.jar you're asking the shell to determine the interrupter to run it with, which it's unable to do. The shell looks for the shebang line at the beginning to the ...


5

Switching java to Oracle JDK is just a workaround in my opinion, as the OP wanted to know why it doesn't work anymore with OpenJDK. Anyway, I fixed it myself using this answer on Ask Fedora. Basically you first have to create a file javajar.desktop with following contents in /usr/share/applications/. [Desktop Entry] Encoding=UTF-8 Version=1.0 Type=...


5

1) Open a terminal (CTRL+ALT+T) 2) cd into the directory containing the Jar file 3) sudo chmod +x yourfile.jar (Replace filename) 4) java -jar yourfile.jar (Replace filename)


4

First install JAVA sudo apt-get install openjdk-7-jre Then download dli-downloader with dependancies package, to your /home wget https://dli-downloader.googlecode.com/files/dli-downloader-5.4-jar-with-dependencies.jar Then you can run java -jar ~/dli-downloader-5.4-jar-with-dependencies.jar Dli-Downloader will now run You can make a "clickable" ...


3

I had to uninstall openjdk-11-jre, eg: sudo apt remove openjdk-11-jre or sudo apt remove openjdk-11* to remove all openjdk-11 packages on your system. This forces your program to run on openjdk-8-jre instead of openjdk-11-jre, as I had both installed. Apparently Java Assistive Technology doesn't run on the openjdk-11-jre package. I believe there is also ...


3

From the terminal run: java -cp .:/path/to/jar/file MyFile where you replace /path/to/jar/file with the full path to your external .jar file which in your question is named jsch.jar and -cp is a shorter way of typing -classpath. Explanation . - current directory : - separator character used to separate class paths /path/to/jar/file - replace this with the ...


3

Right click - properties Click on the "Permissions" tab and make sure the "Allow executing file as program" checkbox is checked.


3

Open the properties again, select the tab "Permissions" and mark the checkbox "Allow executing file as program".


3

The classical method would be ... sudo -i java -jar /home/sethlord/Downloads/Authenticator/Authenticator.jar If you really really need "root" sudo -su java -jar /home/sethlord/Downloads/Authenticator/Authenticator.jar But try to avoid that since it logs notices to user "root" and not the "sudo" account.


3

The java -version command confirms that you're running an older version of openjdk (and you may have mixed in a little Oracle Java 7... choose one, not both). Here's the current version information for openjdk... openjdk version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.10.2-b14) OpenJDK 64-Bit Server VM (build 25.111-...


3

Okay, a few things to note here: Why are your saves under root? Don't run Minecraft with sudo, and then it should be stored in your home directory. ~ is a shorthand for your home directory. The command cd ~/root does not make any sense. Your command should be formatted differently. Try running cd ~/Downloads and then java -jar Minecraft-Installer.jar. If ...


3

You could use the command unzip -l [filename] to list the contents of the jar archive file. First, you might need to install unzip: sudo apt install unzip Example of unzip usage on the file gettext.jar: username@ubuntu-server:~$ unzip -l /usr/share/java/gettext.jar Archive: /usr/share/java/gettext.jar Length Date Time Name --------- ---------- ...


2

I changed cd /home/teamspeak/sbot To cd /home/teamspeak/sbot/ And it loaded into the directory correctly without an error


2

I just recently had the same problem - the way I fixed it was to uninstall OpenJDK 7 and install OpenJDK 6. I have no idea why OpenJDK 7 doesn't want to work but it started glitching when I installed it via the Terminal. Installing OpenJDK 6 is like installing a fresh new version of Java. I had tried many different other commands and they didn't seem to ...


2

You can also use terminal; java -jar /home/al0s/Downloads/asd.jar without installing new things.


2

For some reason the desktop file for OpenJDK is not installed, even though this file is listed. $ apt-file list openjdk-8-jre | grep desktop openjdk-8-jre: /usr/share/applications/openjdk-8-java.desktop openjdk-8-jre: /usr/share/applications/openjdk-8-policytool.desktop $ ls -l /usr/share/applications/openjdk-8-java.desktop ls: cannot access /usr/...


1

Inspired from Marco's answer, but for me it only works in this order (prepending): java -Djavax.accessibility.assistive_technologies=" " -jar aprof-plot.jar It solved the problem and the program launched successfully (in my case argouml.jar fakesmtp.jar). Using Java 8 on Ubuntu 2019.04


1

To run a JAR file via java you need the switch -jar. #!/bin/bash java -Xmx4G -Xms2G -jar file.jar nogui


1

You'll need to create a .desktop file. To do this, create a new file named something like ExampleLauncher.desktop (the name isn't too important, since window managers will likely read the name from inside the file and display that inside). Then, open that file in your favorite editor (double-clicking may not work in this case, so you'll need to drag the file ...


1

This sounds like you messed up the permissions of the Jar file. Check what permissions the file currently has using ls -l /bin/Test.jar. Maybe you didn't give execution permissions to all users or didn't assign read permission. You can simply fix this with a chmod guo+rx /bin/Test.jar and the necessary permissions should be there. Also, please note that /...


1

I actually had this problem, too. I had Java installed and marked the jar as executable, but it still didn't work. Here's how I fixed it (kind of a workaround): Right-click on the jar you want to open and select Properties. Click File Type Options, under the Type section. Click Add under the Application Preference Order and search jar. Select the result, ...


1

Try this. Open a terminal and try running java -version As long as it returns something, you have java installed. You likely haven't marked the .jar files as executable. To do so open a terminal, navigate to where the .jar files are located and run chmod u+x name-of-file.jar Replacing name-of-file.jar with the .jar file you're wanting to run.


Only top voted, non community-wiki answers of a minimum length are eligible