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.
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
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
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)
-
You can suggest an edit, if all this is a version change: askubuntu.com/posts/510983/edit – muru Feb 16 at 9:55
which javac
andupdate-alternatives --list javac
? – steeldriver Aug 7 '14 at 18:29which javac
returns nothing;update-alternatives --list javac
returnsupdate-alternatives: error: no alternatives for javac
– Joel DeWitt Aug 8 '14 at 13:15