Running Java code



Hello, I’m trying to run a simple Java program but keep getting an error.
I am new to Cloud9, so don’t really know what I am doing.

Here is the code i am trying to run:

import java.util.Scanner;

class generator{
    static void generator(){
        Scanner in = new Scanner( );
        System.out.println( "Enter your name,(with no spaces): " );
        String name =;
        System.out.println( name );

public class main{
    public static void main( String[] args ){
        generator name = new generator();

and the error which keeps occurring:

Error: Could not find or load main class .home.ubuntu.workspace.Week0.Java.main                                                                         
Process exited with code: 123` 

Any help would be greatly appreciated.


how do you run it to get that error?
You can use a runner like

    "script": [
        "printf \"\\033[01;34mCompiling all files in\\033[00m \\033[01;31m$ROOT\\033[00m\n\"",
        "OUT_DIR=\"$([ -f .bin ] && rm -r .bin; mkdir -p .bin ; echo .bin)\"",
        "FILES=\"$(find . -path './.c9*' -prune -o -print | grep '.*\\.java' | sed 's:^./::g' | tr '\n' ' ')\"",
        "MAIN_CLASS=\"$(echo $file | sed \"s:$ROOT/::g\" | sed '$::g' | sed 's:/:.:g')\"",
        "COMPILED_FILES=\"$(javac -d $OUT_DIR $FILES)\"",
        "java -classpath \"$OUT_DIR\" \"$MAIN_CLASS\" \"$args\""
    "env": {},
    "info": "\\033[01;34mRunning\\033[00m \\033[01;31m$file_name\\033[00m\n",
    "selector": ""


check your cwd in the terminal, make sure it’s the same as the located if you have not declared any package


How do you make a runner


use run/run with/new runner menu item. see for details