Reputation: 141
So I followed this site here and I don't think the part where I went wrong was the first part when it was talking about directories and stuff. I'm a real noob. Anyways, when I try to run the java program, it says Error: Could not find or load main class Mainclass. Any idea what's going on? I've tried installing the java jdk but that doesn't make a difference.
Details:
Here's a screenshot of what my page looks like.
Is there something I should change in my .build file? (I used the same one on the site). Thanks in advance.
Upvotes: 0
Views: 1365
Reputation: 9
Happened to me recently, the Class file saved in your Cloud9 folder has a lower case letter, different from the Class name uppercase
Filename: Mainclass
ClassName: MainClass
Upvotes: 0
Reputation: 33
Try below code:
sudo apt-get update
sudo apt-get install default-jdk
I cannot see your code but this is a sample code:
class greeting {
public static void main(String args[]) {
System.out.print("hi");
}
}
Upvotes: 0
Reputation:
You need to have a class called Main (or main) with a method like this one:
public static void main(String [] args){
//your main class code here
}
EDIT:
Try renaming your class to "Main" (no quotes).
Large Sized EDIT:
1.You need to make your class public class MainClass
2.You MUST have a package declaration!!!
3.You SHOULD probably rename your class to "Main" and your java file to "Main". Other than that, your programming is pretty solid!
Upvotes: 1