Search code examples
eclipseeclipse-oxygen

Eclipse import external .class file


I have an Eclipse project and I want to import a .class file to use it in the project.I use the properties menu of the project, properties->java build path->add classfolder, to import the folder that contains the class file.

The problem is that the path of the folder which contains the class file, is registered in the class path with the absolute path of the system. And when I change the computer and I clone the project, Eclipse doesn't import the lib. Even though the lib folder form part of the project.

What can I do?


Solution

  • Do you really use add class folder, or do you use add external class folder?

    With the first option, it should use a relative path, so that should work, but then your .class file has to exist inside one of the projects in your workspace.

    With the second option, you can use it when the .class file is not in your workspace, but it will use an absolute path. So there's no way you can have it automatically update to point to a new location when you move/copy your workspace. You'll just have to update your classpath.