1

I'm attempting to compile a Java program using Geany. I get /bin/sh: 1: javac: not found in the Compiler window. The available help out there suggests to make sure you have OpenJDK installed, which I do (6 & 7). Poking around, I find javac in /usr/share/bash-completion/completions. (I'm hesitant to start messing around with Java on Ubuntu since it seems to be so tempermental.) How do I point Geany to my Java installation? Any suggestions will be appreciated.

2
  • what are the outputs of which javac and update-alternatives --list javac? – steeldriver Aug 7 '14 at 18:29
  • which javac returns nothing; update-alternatives --list javac returns update-alternatives: error: no alternatives for javac – Joel DeWitt Aug 8 '14 at 13:15
5

Try fixing the issue by installing Oracle JDK 8. And try to find the correct version for the time being. Before this remove the Default Open-JDK-"version"(your Version) And try this code:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
1

To fix this, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo apt-get install openjdk-7-jdk
0

I apologize, I’d rather like to add a comment, but I don’t have the necessary reputation of 50, only 36. Here’s my annotation:

In 2021, you must write the command as follows:

sudo apt install openjdk-8-jdk

(openjdk-8-jdk instead of openjdk-7-jdk)

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.