How to Tell Eclipse to Include Standard .jar Library for All Projects

后端 未结 4 1041
暗喜
暗喜 2020-12-08 17:36

I realize that in eclipse you can specify certain .jar libraries to add for individual projects, but I was wondering if it was possible to make it such that eclipse automati

相关标签:
4条回答
  • 2020-12-08 17:53

    You can adapt a dependency control and build system like maven and put your dependency jars are properties for the maven modules. This way maven is in charge of putting the jars in a shared place in the maven repository and reusing them across projects. You can then use the Maven eclipse project generator to create your workspace for eclipse. If you project is getting rather big with lots of individual projects in the workspace this is a great automation solution.

    0 讨论(0)
  • 2020-12-08 17:55

    I can't think of a way to do what you want specifically, but what I would recommend, if there were many of these jars, is to create a project to hold these jar files, put them in the projects classpath, and then set the project to export those jar files (that may be the default for jars in the lib directory, I can't remember).

    Then any new projects can simply add a dependency on this "jar" project to get all the jars in there included in its build path.

    0 讨论(0)
  • 2020-12-08 18:04

    By default, if it's a java project then eclipse includes required jar files, but in addition if you need more jars then you could create user libraries by

    Window - Preferences - Java - Build Path - User Libraries.

    rather mixing JDK jars with user libraries.

    0 讨论(0)
  • 2020-12-08 18:05

    Under Window -> Preferences -> Java -> Installed JREs find your default JRE (the checked one) and hit Edit. Add jars that you want.

    0 讨论(0)
提交回复
热议问题