I'm creanting an script to run an .jar on Ubuntu 18.

The project was develop on Windows with Intellij IDEA.

In windows the .jar runs correctly.

But in Linux is show the error:

Could not find or load main class br.com.insper.agil.LinuxScriptsJava

cmd used: java -jar etc/profile.d/jar/LinuxScriptsJava.jar

  • MANIFEST.mf:
Manifest-Version: 1.0
Main-Class: br.com.insper.agil.LinuxScriptsJava

The project is not using external .jar libs.

I need to add some classpath commands in MANIFEST file to run in Ubuntu?


The problem was that the default java version in ubuntu 18 is java 11.

So I used this tutorial to change the version to java 8. And now it's running.

  • Basically the solution was the commands to change the default jdk:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-oracle/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6-oracle/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/java-6-oracle/bin/javaws" 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.