Arr
Arr

Reputation: 799

What i can't run a class file created Intellij Idea?

Have a simple programm:

package com.test;

public class Main {

    public static void main(String[] args) {
        System.out.println("lol");
    }
}

In Intellij Idea project run correctly, but if i run out class file by cmd, like java Main.class i have a Error

Error: Could not find or load main class Main.class

If i compile .java manually - i have some error.

In $PATH path to .../jdk/bin. In Intellij Idea path to SDK .../jdk.

What's the problem?

Thanks!

Upvotes: 2

Views: 522

Answers (1)

Darth Android
Darth Android

Reputation: 3502

Your class is not Main, but com.test.Main. You should use:

java com.test.Main

from the root directory of the compile output (i.e., from the same place as the com/ folder)

Upvotes: 3

Related Questions