NetBeans - 查找我的 Java 应用程序的命令行和参数?
我的 Java 应用程序需要第 3 方 JAR 才能运行。我似乎无法让它从命令行运行。尽管将类路径设置为我想象的正确值,但它还是抱怨 NoClassDefFoundErrors。然而,当我在 NetBeans 中运行它时,一切都很好 - 它按预期运行。有什么方法可以找出 NetBeans 用于运行我的程序的命令 + 参数吗?顺便说一句,这是 NetBeans 7.0。
My Java app needs 3rd party JARs to run. I can't seem to get it to run from the command line. Its complaining about NoClassDefFoundErrors, despite setting the classpath to what I imagine to be correct. However, when I run it in NetBeans, all is well - it runs as expected. Is there any way to find out the command + arguments NetBeans uses to run my program? This is NetBeans 7.0, BTW.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
应该是:
使用 jar 中的 META-INF/MANIFEST.MF 文件来确定将类路径设置为什么。
Should be:
That uses the
META-INF/MANIFEST.MF
file in the jar to determine what to set the class-path to.首先,转到项目属性> “运行”并选择主类(带有主方法的类)。
然后进行“clean and build”以生成一个jar。
然后像这样执行jar
或者如果你安装了JRE,你可以在windows中双击jar
First, go to project properties > 'run' and select the main class (one with a main method).
Then make 'clean and build' to generate a jar.
and then execute the jar as this
Or you can double click the jar in windows if you have a JRE installed
选择“运行菜单”和“清理并构建项目”选项
检查输出窗口,您将在其中看到一行文本,如下所示:
要在不使用 Ant 的情况下从命令行运行此应用程序,请尝试:
此行下面的行将告诉您可以使用的确切命令行从命令行使用计算机上的绝对路径运行此应用程序。
关于
图沙尔乔希,那格浦尔
Choose Run Menu and Clean and Build Project option
Check the output window where you will see one line if text as follows:
To run this application from the command line without Ant, try:
Line below this line will tell you the exact command line which can be used to run this application from command line with absolute path on your machine.
with regards
Tushar Joshi, Nagpur