Search code examples
javacompiler-errorsidecloud9-ide

Setting up Cloud9 IDE to compile and run Java?


I have tried posting this request in Cloud9's forums, but since it never posts, I am hoping someone here could give me a hand. (The forum keeps saying my question is being submitted for review, but then never shows up).

I can't get Java code to compile and run. I've Googled the issue and read other posts in their limited forums, but I can't get it to compile and run a simple Hello World! program. My .java filename matches the class and the code is fine.

I have tried putting my .java files in the following directories:

test/java/

test/src/

I just get this:

bash: src/HelloWorld.java: No such file or directory

I tried this: http://www.programmingforliving.com/2014/09/java-coding-with-cloud9-ide.html

But I just get:

Running HelloWorld.java                                                                                                                                          

Error: Could not find or load main class HelloWorld  

Any suggestions? Given I'm essentially a Java noob I am hoping the solution is fairly simple.


Solution

  • Without you pasting in your code it's tough to tell but make sure your class and filename are both titled HelloWorld. Make sure your src folder is in your main workspace folder so your file should be at /home/ubuntu/workspace/src/HelloWorld.java.

    Also, this documentation looks pretty similar to the blog you referenced but still worth a look https://docs.c9.io/docs/custom-runners.