Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经创建了几个 jar 文件并在 cmd 中运行它们,但最近我无法创建新的......事实上,我制作了一个 jar 文件,但是当我在 cmd 中运行它时,会出现以下错误消息;
exception in thread "main" java.lang.NullPointerException at Sun.launcher.launcherhelper.getMainClassFromJar(Unknown Source)
如果您想以 just 开头,您的 jar 必须在其清单中定义主类java -jar myjar.jar,否则您将需要以java -cp myjar.jar com.example.Mainclass.
java -jar myjar.jar
java -cp myjar.jar com.example.Mainclass