Running Java in Cloud9IDE?



Hello there! Im confused on how to run java applets in my cloud9… Here is my progress so far:

When i click the run button i get:

Building and running twentyone                                                                                                                                                       
bash: line 3: javac: command not found                                                                                                                                                              
Error: Could not find or load main class twentyone  

Here is the code in

import java.applet.Applet;
import java.awt.*;

 * Created by Amanuel on 4/18/2016.
public class twentyone extends Applet {
    protected int x1 = 40,y1=35,x2=30,y2=35;
    public void paint (Graphics page)
        setBackground (Color.CYAN);
        page.drawLine(100,120 ,100,100);


As I saw when we were on a collaborative terminal session, it seems you need an X environment to compile/run your applet. (You installed open-jdk, so javac is not anymore a problem)

This topic (more precisely this github repository) will help you get one for your workspace.
Do this:
git clone cd cloud9-vnc sh ./
Then, modify line 6 of ~/cloud9-vnc/ to match supervisord.conf location with this:
cd /home/ubuntu/workspace/cloud9-vnc

Then you can run sh ./ and open, click connect and you will see your desktop.
Left-click to open a bash terminal and from ther you can run appletviewer in this X environment.

Hope it helps.
Feel free to ask if something goes wrong.


The thing works now… but when i run appletviewer i get:

Exception in thread "main" java.awt.HeadlessException: 
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at java.awt.GraphicsEnvironment.checkHeadless(
        at java.awt.Window.<init>(
        at java.awt.Frame.<init>(
        at java.awt.Frame.<init>(
        at sun.applet.AppletViewer.<init>(
        at sun.applet.StdAppletViewerFactory.createAppletViewer(
        at sun.applet.AppletViewer.parse(
        at sun.applet.AppletViewer.parse(
        at sun.applet.Main.main(


@EtienneWan worked it out fourtunately! :smiley: We just adjusted some stuff -.- … and it worked. If you guys are aiming at making java applets, you can just go to that workspace i posted above and try to immitate it! Thanks to @EtienneWan !


that github repository no longer exists. What did it contain?


there is a fork at