为什么netbeans生成jar不能运行?
init:deps-clean:DeletingdirectoryD:\MYJAVA\JavaApplication78\buildDeletingdirectoryD:...
init:
deps-clean:
Deleting directory D:\MYJAVA\JavaApplication78\build
Deleting directory D:\MYJAVA\JavaApplication78\dist
clean:
init:
deps-jar:
Created dir: D:\MYJAVA\JavaApplication78\build\classes
Created dir: D:\MYJAVA\JavaApplication78\build\empty
Compiling 1 source file to D:\MYJAVA\JavaApplication78\build\classes
Copying 2 files to D:\MYJAVA\JavaApplication78\build\classes
compile:
Created dir: D:\MYJAVA\JavaApplication78\dist
Building jar: D:\MYJAVA\JavaApplication78\dist\music.jar
Not copying the libraries.
To run this application from the command line without Ant, try:
java -jar "D:\MYJAVA\JavaApplication78\dist\music.jar"
jar:
成功生成(总时间:1 秒)
我点击的是dist文件夹下面的jar文件,所有的都不能运行,我想可能是我的方法不对,或者那里设置错误了,问高手指教下,谢谢!
public static void main(String[] args)
{
MusicFrame musicf = new MusicFrame();
musicf.setLocation(250,250);
musicf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
musicf.pack();
musicf.setVisible(true);
} 展开
deps-clean:
Deleting directory D:\MYJAVA\JavaApplication78\build
Deleting directory D:\MYJAVA\JavaApplication78\dist
clean:
init:
deps-jar:
Created dir: D:\MYJAVA\JavaApplication78\build\classes
Created dir: D:\MYJAVA\JavaApplication78\build\empty
Compiling 1 source file to D:\MYJAVA\JavaApplication78\build\classes
Copying 2 files to D:\MYJAVA\JavaApplication78\build\classes
compile:
Created dir: D:\MYJAVA\JavaApplication78\dist
Building jar: D:\MYJAVA\JavaApplication78\dist\music.jar
Not copying the libraries.
To run this application from the command line without Ant, try:
java -jar "D:\MYJAVA\JavaApplication78\dist\music.jar"
jar:
成功生成(总时间:1 秒)
我点击的是dist文件夹下面的jar文件,所有的都不能运行,我想可能是我的方法不对,或者那里设置错误了,问高手指教下,谢谢!
public static void main(String[] args)
{
MusicFrame musicf = new MusicFrame();
musicf.setLocation(250,250);
musicf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
musicf.pack();
musicf.setVisible(true);
} 展开
展开全部
生成的Jar要运行的话,必须要选择一个主类作为其实类的才能运行,而且这个主要要有main方法作为程序的入口的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
上面不是写清楚了
To run this application from the command line without Ant, try:
java -jar "D:\MYJAVA\JavaApplication78\dist\music.jar"
To run this application from the command line without Ant, try:
java -jar "D:\MYJAVA\JavaApplication78\dist\music.jar"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把main函数内容贴出来才知道
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询