4

I want to add this library from Github to a new Java project. https://github.com/jmdns/jmdns

I have searched and found only methods to add jars and not source code of libraries.

How do I add source code of libraries and import from them in my project in Intelli.

It'd be cool if the library above was specified as an example.

Kotlinboy
  • 3,725
  • 4
  • 16
  • 27

1 Answers1

2

I found an answer on my own using two other QnAs on SO.

1) First you need to create a separate project containing the source of the library and compile it as jar.

If it's from Github you can just select File-> New-> Project from version control-> Git and create a new project from the github source.

Then you need to compile it as jar or artifact in Intellij

Look at this question for that:

How to build jars from IntelliJ properly?

2) Then you need to open your project from which you want to import the jar or library and add it to the project and add it or register it as library.

Look here for that: Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project

After doing these two steps I was successfully able to import the library.

Kotlinboy
  • 3,725
  • 4
  • 16
  • 27