Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple main methods in java package

I have a project in NetBeans where two different classes have public static void main(String[] args) methods. When I press F6, the first class' main is always invoked. Why not the second? When I'm trying to display arguments of args, it says that this array is empty.

like image 828
Sergey Avatar asked Jan 18 '26 00:01

Sergey


1 Answers

In the project properties, in the Categories, choose Run. then there is a Main Class. Set your main class there

like image 84
tanyehzheng Avatar answered Jan 19 '26 13:01

tanyehzheng



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!