Hi, i�m using miglayout in a little project, works great when i execute my gui in eclipse 3.3, but when i export the project into a jar file, it gives me "NoClassDefFoundError: net/miginfocom/swing", i dont know how to solve it since i have added the miglayout-3.6-swing.jar to the proyect classpath.
I think the standard jdk jar(rt.jar) is not on your classpath, considering it is not a ClassNotFoundException but a NoClassDefFoundError which your are getting.
posted 12 years ago
i've tried java -classpath miglayout-3.6-swing.jar -jar miproyect.jar and also java -classpath miglayout-3.6.jar -jar myproject.jar, still not working, i have another version of the same proyect that dont use any external libraries and works fine.
You don't need rt.jar in your classpath, at least not for recent versions of Java.
One thing I have tried is copying the .jar into the current directory where you can start your application by writing java foo.bar.MyClass, then unzipping the .jar. You then have the jar folders in the same directory as your own folders, and it is a naughty cheat technique, but seems to work.
posted 12 years ago
I've decompressed the jar that eclipse generated, this is the dir structure: .settings -->dir META-INF --> containing manifest indicating the main class controller --> dir model --> dir view --> dir, where the miglayout.jar is needed, so i've put the miglayout.jar here .classpath --> file .project --> file
Then i've created a new jar --> jar cmf META-INF\MANIFEST.MF MyProject.jar * But still have the same error message [ November 08, 2008: Message edited by: Jorge Bendahan ]
you are saying that miglayout-3.6.swing.jar and miproyect.jar are both in the directory where you are running the java command from. If either are in different locations you need to provide the absolute path to either/both. So something like:
Ok, I think I have figured out the problem. I was running into the same problem as you were. Then I realized that we are using the MANIFEST file to specify the main class. By doing this the -classpath switch pretty much gets ignored. So you have to tell the MANIFEST file what your classpath is. After doing this, it worked for me. Your new MANIFEST file should look like this:
Gregg actually took the time to examine the jar file and found the problem , i apologize for the code, pretty bad yet. But i'm learning, i must add threads to the gui and other major improvements. Thanks again.
Originally posted by Jorge Bendahan: Gregg actually took the time to examine the jar file and found the problem , i apologize for the code, pretty bad yet. But i'm learning, i must add threads to the gui and other major improvements. Thanks again.
No problem at all. Glad I could help. My biggest hurdle was not knowing spanish.
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad: