Reputation: 21
I'm trying to make a small GUI app and I want to use MigLayout with it. As Java newbie I don't know how to get MigLayout to work with my code and I'm running out of ideas.
My project source code is in ~/git/project/src/qdb/
The qdb is my java package name. I downloaded miglayout-3.7-swing.jar and miglayout-3.7.jar and placed them to my project sources and tried to compile the code but I get errors pointing to "new MigLayout()
" stating "cannot find symbol".
I was in src dir and used "javac qdb/*.java
" to compile (*
gets expanded).
I also tried to point classpath to my sources like: "javac -classpath /home/user/git/project/src/qdb/ qdb/*.java
" but I still get the error.
Then I've also tried to put the jar files to ~/jars/ and use that as classpath but still the same error follows.
So, how to get MigLayout working?
Upvotes: 1
Views: 3135
Reputation: 1330092
Simply add the miglayout-3.7-swing.jar
to your classpath:
javac -classpath /your/path/to/miglayout-3.7-swing.jar qdb/*.java
(as illustrating in this thread Installing Mig Layout)
If you can compile them (with the above line),
but can not execute the resulting program, you also need to add to the java
classpath the library
java -classpath /your/path/to/miglayout-3.7-swing.jar:/your/project/compiledClass/dir qdb.yourMainClass
Upvotes: 1
Reputation: 181460
VonC's answer is right. I just want to add (since you are a Java newbie) that you should consider developing using an IDE. They'll save you hours of by-hand-compiling, and will help you integrate your code with libraries (such as MigLayout) more easily.
There are two free IDEs I really like:
IBM's Eclipse.
SUN's (soon to be IBM's) Netbeans.
Also consider this SO thread. And this one too.
Good luck.
Upvotes: 1
Reputation: 1138
If you are going to put it into a .jar file, you'll need to specify the Class-Path in the manifest file:
Class-Path: /your/path/to/miglayout.jar
Upvotes: 1