0

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?

Justin Duncan
  • 88
  • 1
  • 6
  • chances of us noticing anything looking at a very small print-screen are quite thin. my advice, install maven and let that handle dependencies. Either way, you don't show any import statements, we have no idea what's in that .jar, ... – Stultuske Jun 08 '18 at 08:22
  • Try adding it via external Jar. – Amal Gupta Jun 08 '18 at 08:23
  • You can try removing the reference to the `jar` file, and adding the `comp121` project, go to JavaBuildPath>Projects>Add.. and add that project. Of course, you'll need to fix the comp121 project first – Daniele Jun 08 '18 at 08:24
  • 2
    Your default package in `lab01.jar` is not inside `src` folder. – Shanu Gupta Jun 08 '18 at 08:25
  • @Stultuske on the left it shows what is in that Jar. If you look under References Libraries, also the picture is bigger if you click on it. amal I have tried that and it doesn't work. I just tried that... and nothing but thanks I will also try moving folders entirely. Shanu I don't know how to move the classes from default to src under Referenced Library, I was under the impression Eclipse set this up on its own. I will research this thanks. – Justin Duncan Jun 08 '18 at 08:43
  • 1
    @JustinDuncan as Shanu already commented ... all code should be in the src folder. You should also never have any code in the default package. – Stultuske Jun 08 '18 at 08:49
  • It is because I am not using the default package in my project. Whenever I move my files to the not recommended default package they recognize the jar file. Is this normal behavior? Can I change this somehow? – Justin Duncan Jun 08 '18 at 21:35

1 Answers1

0

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.

Justin Duncan
  • 88
  • 1
  • 6