wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes How to Include Zip files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to Include Zip files " Watch "How to Include Zip files " New topic
Author

How to Include Zip files

Jason Wylde
Ranch Hand

Joined: May 25, 2009
Posts: 30
Hi,
I'm trying to use a JAR file that I created in Netbeans in my Eclipse project. The layout of the Netbeans files are the following.

MyJarFile.jar
/lib/swing-layout-1.0.3.jar

Based on documentation I was told that I could zip up these files and then include them in my eclipse project but that doesn't seem to work. If I try to import a class from MyJarFile.jar Eclipse doesn't understand it. I added the zip via Java Build Path > Libraries > Add External jars. What am I doing wrong ?
If I build the JARs into 1 jar file I can import and call my class but nothing seems to happen and no exceptions are thrown. If I try calling the JAR file ( that includes both JAR files ) in Netbeans I get the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group




Thanks In Advance

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18507
    
  40

I added the zip via Java Build Path > Libraries > Add External jars. What am I doing wrong ?


That feature configures a project to use a jar file (that contain classes). It is not used to import jar files (that contain other jar files).

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jason Wylde
Ranch Hand

Joined: May 25, 2009
Posts: 30
I would however use Java Build Path > Libraries > Add External jars if I wanted to include other JAR files in my build path correct ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
Sound like an IDE-specific problem. Moving thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Include Zip files
 
Similar Threads
class not found in Eclipse-built external jar, but found in Netbeans-built one
Exporting to jar file in eclipse
Eclipse: What, exactly, does the "Add External Class Folder" button really do?
Including a jar within a jar
Runnable jar is not including the files