Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use MiG Layout with Eclipse?

I've been Googling and checking on Stack Overflow and nothing has helped... hopefully someone can.

I usually just write my code by hand, but I'm working on a Java project that has a GUI aspect and I like what MiG Layout has to offer so I want to use it. I've downloaded the .jar file from the website, but I can't seem to be able to access it from my project.

I'm using Eclipse now as my IDE for this project because I don't want to have to deal with this particular thing by hand. I'm new to Eclipse, but here's what I've been trying: import the .jar file (via the Import tool for the project), then add the following code to my files:

import net.miginfocom.swing.MigLayout;
import javax.swing.*;

According to this page, this should work, right?

But when I try to run the program, I'm met with this message:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    MigLayout cannot be resolved to a type

What am I doing wrong?

like image 408
Josh Leitzel Avatar asked May 02 '09 20:05

Josh Leitzel


1 Answers

It sounds like the "import tool" part didn't work properly - that Eclipse isn't actually using the jar file.

I suggest you right-click on the project, choose Properties, and go to the Build Path page. Look under the "Libraries" tab. Assuming the jar file isn't there, add it and all should be well.

like image 181
Jon Skeet Avatar answered Oct 04 '22 06:10

Jon Skeet