-2

I'm trying to write a Java program in Intellij on Ubuntu 18.04. There is nothing wrong with the code, I can run it on my Windows machine at home.

When I'm trying to build the program i get the following error message:

Error:Cannot run program "/usr/bin/jdk1.8.0_202/bin/java" (in
directory "/home/oskar/.IdeaIC2019.1/system/compile-server"): error=2,
No such file or directory
Smajl
  • 7,555
  • 29
  • 108
  • 179
cephlot
  • 144
  • 1
  • 12

1 Answers1

3

First of check that /usr/bin/jdk1.8.0_202/bin/java is present - as in check that you have the Java SDK.

If you have it, Then you need to specify the SDK for your project in Intellij. To do this goto "Project Settings" and select your SDK with the drop-down, as shown below

Goto "File" → "Settings" → "Project" and you will see the below menu.

InteliJ Project Structure

If you don't have the Java SDK there, go ahead and install the Java JDK download from https://www.oracle.com/technetwork/java/javase/downloads/index.html
After installing the SDK, navigate to "Project Settings" again and select the new JDK configuration from the installation location.

Then you can build the project and it should work all fine!

UrbanConor
  • 162
  • 1
  • 5
  • 16