Search code examples
javaeclipselibrarieseclipse-jdt

How to make custom library container for Java in Eclipse?


So, I need to use lots of libraries.

Usually I just added the libraries through Java build path, but when I added lots of libraries, it is complicated and it is not manageable.

So I have searched some ways to resolve this problem.

So I found that I can use org.eclipse.jdt.

I want to input three jar files to my custom container which name is sqldriver.

  • mariadb-java-client.jar
  • mysql-connector-java.jar
  • ojdbc6.jar

and I will use the libraries programmatically like this

  • new sqldriver.oracle.jdbc.OracleDriver()
  • new sqldriver.com.mysql.cj.jdbc.Driver()

Is this possible?

or I just want to manage three jars in one container.

Can you help me?

I need some examples to make my own custom container.

Let me know how to do it.


Solution

  • You need to implement a tiny Eclipse plug-in providing two things:

    The initializer will have to be registered at the classpathContainerInitializer extension point.

    As an example I suggest you have a look at JDT's JUnitContainerInitializer.