简体   繁体   中英

The new class in my second package in the same project doesn't run in Netbeans

I've made a new package in the same project, and I can't seem to run the class in the new package. When I click on Run while in the new class, it doesn't run. Any ideas, on how to run this new class? I'm new to Netbeans and Java. Files look like this:

  • JavaApplication1 (project name)
    • Source Packages
      • javaapplication1
        • Test.java
      • javaapplication2
        • NewClass.java

Does the NewClass have main metod? If yes you have 2 options.

  1. You can select main class for procject by rigth clickong on project and selecting Propperties . And then in Run node select main class as shown in image blow. 在此处输入图片说明

2.) You can run specific file from ide by rigth clickin on file and select run file as shown in image below.

在此处输入图片说明

看起来您的第二个软件包不被视为构建的源,您需要更改项目设置,以便也构建第二个软件包

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