Howto run simple program with javac



I’m trying to run a simple helloworld program as per this youtube tutorial about Cloud9:

However, when I try to javac my main class, I get an error about “javac not found.”

Your setup is much like my sftp server I set up at school using Ubuntu. However, my school has a new firewall that blocks my students from logging in from home. So, I’m looking for an online server such as yours.

Please help,
A. Jorge Garcia


This thread should help out ;):


I tried using the custom workspace as per the video. I figured that gave me an Ubuntu environment much like the one I provide at school for my students: text editor + shell with jdk installed.

Looks like openjdk is installed but not the standard jdk from Oracle? I can’t get javac recognized, What’s going on?

I would love to use your environment with my students so they can work at home with an environment they are used to and get ahead on their assignments!

Please help!


“javac: command not found” thread above said this works,
sudo apt-get install openjdk-6-jdk
but it didn’t…


Any way I can get javac running on c9?


try in a terminal:
sudo apt-get update sudo apt-get install default-jdk
and then javac works

user:~/workspace/java $ java -version
java version "1.7.0_121"
OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.3)
OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode)

user:~/workspace/java $ javac
Usage: javac
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing


Thanx, I got it working!


This really works.
first type the below code in terminal—
sudo apt-get update

then type this
sudo apt-get install default-jdk

thanks @inforcad for this.


It worked. Thanks @inforcad and @Ayushtwentysix