How to run a NetBeans project in command prompt?

后端 未结 8 996
挽巷
挽巷 2020-12-14 19:51

My professor asked us to create a Java program that would be able to run in command prompt but could also be opened using NetBeans.

The program is about using the di

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 20:27

    1. It would be better to add javac to your PATH environment variable instead of putting the .java files into the same directory with it. It'll get awfully crowded in there.
    2. To run, you just need

      java Main

      instead of putting every class on the command line.

    3. Did you declare a package in your .java files? Like,

      package myjava;

      ? If so, the command string must be

      java myjava.Main

    Does that answer your questions?

提交回复
热议问题