-1

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.

enter image description here

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

enter image description here

I'm apologizing in case I overviewed the solution.

Michele Dorigatti
  • 811
  • 1
  • 9
  • 17
Draz
  • 19
  • 3
  • 6
    Your class needs a `public static void main(String[] args) { ... }` method. See [Java `main` Method](https://www.baeldung.com/java-main-method) – Jesper Jan 27 '20 at 11:41
  • your class is incomplete and doesn't contain an entry point, which is the very minimum in order to be able to run a class. If this puzzles you, you might want to consider stop using professional IDE's. – Stultuske Jan 27 '20 at 11:43
  • Thank you for the hints. Understood and implemented the suggestions. Started out last week, so there is lot of place for improvement. – Draz Jan 27 '20 at 13:55

1 Answers1

1

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.

Muhammad Yawar
  • 424
  • 1
  • 3
  • 19