How to run single Java file from a project in Eclipse?

前端 未结 7 850
慢半拍i
慢半拍i 2020-12-29 22:54

I want to run one Java file from a project in Eclipse. There is code to insert into database in that Java file, I want to check from that single file whether its working or

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 23:36

    Sure, you just need a main function for any independent file.

    Create a class like so:

    public class HelloWorld
    {
        public static void main(String[] args) {
            System.out.println("Hello World");
    
        }
    
    }
    

    and run that.

提交回复
热议问题