简体   繁体   中英

IntelliJ IDEA does not run class

Short note beforehand: saw questions( IntelliJ IDEA running the wrong class and IntelliJ IDEA not correct Run java project ) answered but they didn't help.

After starting a new class(in this case CaesarCipher) and typing the code there is no option to run it.

After I press right-click on it in the source folder on the left, there is no option to run.

在此处输入图片说明

And in the toolbar, it is not possible to choose the class.

在此处输入图片说明

I'm apologizing in case I overviewed the solution.

First of all, You should remove the enlisted errors on stacktrace from your test.java class .

I can see the class you created CaesarCipher.java doesn't have any public static void main(String[] args) method.

In order to run class you need to put in your main class.

public static void main(String[] args){

}

or you can reference your sub class in to main class like this:

public class Main{

    public static void main(String[] args){
         CaesarCipher caesarCipher = new CaesarCipher();
         CaesarCipher.caesarify("encrypt", shift); //put your real params values
    }
}

Hope this helps. Don't forgot to mark solution as accepted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM