0

For some reason, I can't get java to run my program. Whenever I try I get the message

"Error: Could not find or load main class Project"

In Command Prompt I type cd Documents since the file is in my Documents folder, type

javac Project.java

then

java Project

to try and run it but I get the above error message.

import java.util.Scanner;

import java.text.DecimalFormat; 

public class Project
{
    public static void main(String[] args)
    {
        Code and stuff
    }
}

There's a fair bit of code that I left out but I think this is the part that's messed up. Let me know if you need to see the rest of the code and I'll edit this.

2
  • 1
    Add the command prompt lines you are running and their output. Commented Oct 14, 2015 at 17:11
  • Do you get any errors after compiling? Commented Oct 14, 2015 at 17:14

2 Answers 2

4

Change

java Project

to (assuming Project.class is in your current folder)

java -cp . Project

as it is, you aren't setting a class-path.

Sign up to request clarification or add additional context in comments.

Comments

0

You have add the path of .class files in classpath during execution

Run following command:

java -classpath C:\Users\DELL\Documents Project

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.