且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在IDE之外运行Java Swing应用程序

更新时间:2022-10-21 11:24:32

请按照 LINK 和其他系统将需要JRE运行。



我想你缺少 swing-layout-1.0.jar



要添加Swing布局扩展库:



右键单击项目的库节点,然后选择添加库。



在添加库对话框中,选择Swing扩展布局,然后单击添加库。



单击确定关闭项目属性对话框。






除了执行Shiv建议之外,我遵循链接,它点击我,因为我做错了。


I created a small swing application having some GUI components and some java code. When I run it from the IDE, I see GUI open and it works as expected. Now I want to distribute this application to others and it will be run on different machines. I am just wondering as how could I distribute it?

Under project folder, I see following -

-dist
--lib
----some required jar files
--project.jar

-build
--classes
----packagename folder -->UI classes
----projectnamefolder--->projectname.class
--empty
--generated-sources

I am using Windows 7 64 bit with jdk 1.7. Earlier I was able to distribute such apps and they worked from command line or by double clicking .jar file.

Is there anything different in case of swing apps? Kindly suggest.

If I run from command prompt the jar file located under dist folder, it doesn't throw any error but no GUI appears.

Follow these Steps in LINK and other system will need JRE to run.

I think you are missing swing-layout-1.0.jar

To add the Swing Layout Extensions library:

Right-click the project's Libraries node and choose Add Library.

In the Add Library dialog box, select Swing Extensions Layout and click Add Library.

Click OK to close the Project Properties dialog box.


Additional to doing what Shiv suggested, I followed link , and it clicked to me as what was i doing wrong.