How to run a NetBeans project in command prompt?

后端 未结 8 1000
挽巷
挽巷 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:21

    Create a folder somewhere, say C:\myjava. Copy your .java source files from wherever netbeans saves them to your C:\java for example. Open each of these .java files you have just pasted and delete the line that states the package e.g package myjava. Compile using javac e.g. javac c:\myjava\MyJava.java. Then run it as in, java c:\myjava\MyJava

提交回复
热议问题