Search code examples
javaimportreferencereference-library

Eclipse not recognizing class after import of jar file


I have tried creating new projects. Removing and adding the jar file. Nothing is getting this thing to recognize it. I don't know if I am adding this correctly or not. Could someone please direct me, thanks.

Not recognizing Money class

EDIT: After some research using the help from the comments, it seems the problem is that the jar file only works if I am using a default package. I obviously don't want to use the default package so how can I change the Jar to fix this?


Solution

  • I don't know if this is a workaround or fix. I had to exclude the folders from my build path to use the jar file that had a default package. I did figure out how to deconstruct/reconstruct but for future reasons, I would not want to do this everytime someone hands me a file using the default pkg. So here is a screenshot of a working setup: enter image description here

    Please click it if it is not big enough for you. The summ/wint folders are excluded and I am able to use a class from the jar file without editing the jar file.

        Money dd = new Dollar();
    

    Thanks for all the comments.