How to run java on cloud9?

java

#1

I’m new to cloud9 and I’m not sure how to run java code on here. I have read some articles about it and I was informed that if I do

javac Testing.java
then
java Testing

It will run my file assuming it is name “Testing”.

My code is just
public class Testing {
public static void main (String args []){
System.out.println(“Hello World”);
}
}
I got an error that says “bash: javac: command not found”.
Some people say I need a create my own builder and runner so I did that too according to this video.


Don’t speak his language, but I followed the description and his steps and it still does not work.

Can anyone help me with this? I need to be able to code on cloud9 because I will be using a chromebook in class.

Thank you!


#2

try installing java by running

sudo apt-get update
sudo apt-get install default-jdk

see https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04#installing-the-default-jre-jdk


#3

Thank you! It works!


#4

To Update to the latest version …1.8.0_151 as of today … type this in command like on fresh site

curl -sL https://gist.githubusercontent.com/naxmefy/c9b49d10de6827a336f81e6cbcccabe3/raw/16b84294f32c151c3f4951602b736898f036af7f/c9-java8.sh | sudo bash -


#5

Hey…Guys…One Quick Question…
When I Created My Workspace With “Blank Template” For Java Project, It Came With Java Compiler and Required Dependencies Pre-installed…Then How Come It Won’t Be Working?


#6

I think because they are not updating the templates… so you have to update them to latest versions… I just start with clean machine and load everything myself. Then I keep a “Copy” of it as a blank-slate environment (with the latest versions ) and clone it for a new project etc.
I hope that helps. when updates come out I update my blank-slate.