使用从.jar导入的MigLayout [英] Using MigLayout imported from .jar

查看:292
本文介绍了使用从.jar导入的MigLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常在Eclipse中工作.在我的程序中,我使用以下来源的miglayout-4.0-swing.jar文件:链接.
.jar文件中的某个地方是带有 MigLayout 的类.
我使用这些导入:

I'm usually working in Eclipse. In my program, I'm using this miglayout-4.0-swing.jar file from this source: link.
Somehere in the .jar file is class with MigLayout.
I use these imports:

import net.miginfocom.layout.Grid; 
import net.miginfocom.swing.MigLayout;

//它来自jar文件.

//It's from the jar file.

在Eclipse中,我只添加了库:
Java构建路径->库->添加JAR/添加外部JAR-> miglayout-4.0-swing.jar的路径
因此,在所有工作中.
但是我需要从终端运行它:java(我不使用包,所以我只使用bin中的类),但是.jar文件存在问题,因为myMain类可能不知道该类在哪里.jar(不适用于上方的导入). 我尝试将.jar文件复制到类所在的同一目录中.无济于事. 如何正确添加.jar文件?

In Eclipse i just add library:
Java Build Path -> Libraries -> Add JARs/Add external JARs -> path to miglayout-4.0-swing.jar
So in Everything working.
But I need to run it from terminal: java (I don't use packages so i use just classes from bin) but there is the problem with the .jar file, cause myMain class probably don't know where are the classes for that .jar (doesn't work the imports upper). I tryed copy the .jar file to same directory where are the classes. Doesn't help. What should I do to add the .jar file correctly?

推荐答案

命令行java命令不知道在何处查找miglayout jar文件.您应该从命令行运行,例如

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

java -cp path_to_miglayout_jar myMain

这篇关于使用从.jar导入的MigLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆