1

I did the following to add jar files to my Java project: https://stackoverflow.com/a/325545/2653179

It worked, but what do I do if I want to send my project to another computer? The project on another computer doesn't recognize the import when doing so.

Community
  • 1
  • 1
user2653179
  • 393
  • 1
  • 6
  • 21

1 Answers1

1

You should send the JAR files too, so that they can recreate the project on the other computer.

Usually the source files and the JARs are placed in some version control system and the people pull/get the JARs from there so they can recreate the project on the other/local computers.

Make sure the project does not contain any paths which are specific to the computer it was created on (like absolute paths). This will make its moving to another computer much easier.

enter image description here

peter.petrov
  • 38,363
  • 16
  • 94
  • 159
  • They're included in a lib folder, I did the steps in the link. – user2653179 Dec 24 '13 at 20:43
  • 1
    @user2653179 OK, so zip everything and send it to the other computer (including the JARs). – peter.petrov Dec 24 '13 at 20:44
  • Done that too. Then I did an import to the whole project in Eclipse. The JARs appear there in the lib folder, but I'm still getting the error. – user2653179 Dec 24 '13 at 20:46
  • 1
    @user2653179 Refresh your project in Eclipse and check the project's Java Build Path too. See if there are any issues there. – peter.petrov Dec 24 '13 at 20:46
  • In the Build Path, it says (missing) next to the JAR, even though it's not. – user2653179 Dec 24 '13 at 20:51
  • 1
    @user2653179 See my updated answer. See if your project contains any paths which are specific to the computer it was created on. Normally you should avoid absolute paths in your project. Also, see if the lib folder is refreshed and Eclipse sees it properly. Good luck. – peter.petrov Dec 24 '13 at 20:53
  • Thanks, the problem is a specific path on my computer. How do I solve it? Eclipse sees the lib folder when clicking "Add JARs", but I still get an absolute path. – user2653179 Dec 24 '13 at 20:56
  • 1
    @user2653179 You should recreate the project on the project creating computer. When doing so and when adding the JARs use the button "Add JARs" and not "Add External JARs" See the screenshot in the updated answer. – peter.petrov Dec 24 '13 at 20:59