Using MigLayout imported from .jar

余生长醉 提交于 2019-12-02 04:02:19

Command line java command don't know where to look for the miglayout jar file. You should run in from command line like

java -cp path_to_miglayout_jar myMain

Pretty old question, but for the sake of completeness:

You need both . (current directory) and miglayout-4.0.jar to be on your classpath. You have two ways to do so. The easiest is to use -cp

In your case, you'll need to run:

java -cp "path_to_miglayout_jar/miglayout-4.0-swing.jar:." myMain

or if you work on a Windows OS:

java -cp "path_to_miglayout_jar/miglayout-4.0-swing.jar;." myMain

If unsure if you need to use a ; (colon) or a : (or whatever the OS is asking for), you can take a look at java.io.File.pathSeparator which contains the correct separator.

The other way would be to change your CLASSPATH variable.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!