Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Today's Messages (on)  | Unanswered Messages (off)

Forum: Newcomers
 Topic: User Libraries
User Libraries [message #1864620] Fri, 29 March 2024 01:12
Linus 12 is currently offline Linus 12Friend
Messages: 1
Registered: March 2024
Junior Member
I have been working with the Eclipse IDE for a number of years, mostly basic stuff, seemingly able to get things to work just fine. However I recently had to update a project that I hadn't modified in 3 months and now something has changed and I can't figure out where the problem is occurring to fix it.

My apologies if the nomenclature I am using is incorrect, but I'm hoping you can help me figure out what is going on.


Environment:

Eclipse
Eclipse Java EE IDE for Web Developers.
Version: Neon.3 Release (4.6.3)
Build id: 20170314-1500
Windows
Windows 10 Pro
Version 22H2
OS Build 19045.4170

Project Information
Working on an Java Workspace, with 6 "Java Projects" that 'compile' into a single 'program'

Some, but not all, of the "Java Projects" use specific and unique Jar files for classes provided either via GitHub or other repositories. In each of the projects that use them, I have added them into the project via the "Referenced Library" via the Build Path -> Configure Build Path... -> Java Build Path dialog box.

Again, some, but not all, of the "Java Projects" use a set of Jar files with "common classes" that I have written. Mostly utilities to perform some action or hold data that is common across all of my projects. (My toolbox, if you will.)

Initially I also added these to each project's "Referenced Library". The problem I ran into was that if I modified the 'common classes' I then had to update every project's "Referenced Library" with the new Jar File, Source file, and Java doc file.

The solution to that was to place these jar files with the 'common classes' into a User Library. I then added the User Library to those projects that that used these 'common classes'. When there was a change to one of those, simply updating the User Library changed the jar for ALL of the java projects that referenced that User Library. Great Stuff!!!

Now fast forward 3 months....

Due to a pending computer upgrade, I moved all of my source files from my local machine to server I set up. I access the files through a drive letter on my windows machine.
Eclipse had a problem when I tried to "modify" the "Workspace" to point to the new locations, so I started fresh and created new workspaces and pulled in the packages one by one and set up the libraries connections, etc. I did NOT reinstall Eclipse or move it.

Making changes to the workspace projects works well, testing via the IDE also works.....

Problem with Exporting
All of my programs are run via command files on my machines, This allows me to schedule them at different times and frequencies, as will as run them mostly unattended. I do this by exporting the workspace to a Runnable JAR File, and then invoking them via the command files.

I use the "Export,,, -> Runnable JAR File... -> Runnable JAR File Export" dialog box. I specify the Launch Configuration, the Destination File, and "Extract required libraries into the generated JAR" option. and press Finish.

The JAR file is created with no errors and no warnings.

However the JAR file is actually smaller than than the ones created before moving the source files, despite the fact that I have added additional packages inside a number of the Java Projects.

Running the programs via the command line results in the error:
Exception in thread "main" java.lang.NoClassDefFoundError: jutils/Errs

(Yes, I do have a "main" and everything worked fine before.)

Sure enough, the jutils/Errs is one of those classes in the JAR files contained in the "User Library"!

No amount of removing, re-adding, deleting the and recreating the "User Library", cleaning, closing, reopening, the projects, seems to solve this problem. I can open the resulting JAR files (using WINRAR) and can clearly see the classes in the "old" JAR file, but they are missing from the new JAR files.

The only solution I have at this point is to add all the "Common Classes" back into the "Referenced Library" of each of the projects. This of course causes a maintenance issue when one of those are changed (which was originally solved by going to the User Library!)
This does work, but the exported JAR file is now almost 1.5 times as big as before!

Question
I know I must be missing something, a pointer to the files or file link. But I just can't see the forest for the trees right now. Could I get some insight from someone on this? i hoping the fix is something stupid I just over looked. ( I have no problem saying "Duhhhh" after finding a simple solution while looking for a complex one!)

Thanks



Current Time: Fri Mar 29 09:43:33 GMT 2024

Powered by FUDForum. Page generated in 0.02007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top