This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

How to Include Zip files

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
author
Posts: 23883
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Jason Wylde
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would however use Java Build Path > Libraries > Add External jars if I wanted to include other JAR files in my build path correct ?
 
Marshal
Posts: 70384
283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sound like an IDE-specific problem. Moving thread.
 
His brain is the size of a cherry pit! About the size of this ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic