r/javahelp • • Jun 17 '19

Running one Java program in Intellji will launch and run another program.

https://youtu.be/ZWjF_4P1CQg

It's really annoying. No matter what I do, another program runs. I have separated the Package file*, but it didn't work.*

Do we need to create a new project every time we want to run a new small java program ?!

0 Upvotes

5 comments sorted by

2

u/nutrecht Lead Software Engineer / EU / 20+ YXP Jun 17 '19

I'm not going to view a youtube video. But no; you can have multiple main classes in a single IntelliJ project.

1

u/Arunzeb Jun 18 '19

What should i do? Don't create a program without any main class?

2

u/Opetich Jun 17 '19

The project didn't even seem to run since it's not possible to compile.

I think it just changed the class view because it was the first error it found

2

u/LambdaThrowawayy Jun 17 '19

A possible entry point to your program is the main method. You can have multiple main methods; just run using the relevant one.

1

u/GreenCartographer Jun 17 '19

No, you could learn to use the command prompt and javac.