How do I import a .jar file without using an IDE? (Java)

-4

Ex: I have a .jar file that I need to import to get access to api, how do I get it right in the code? I do not know if I was specific, but how? (Without IDE)

    
asked by anonymous 24.06.2018 / 20:30

1 answer

2

You can pass some parameters at compile time:

javac -classpath lib/bar.jar com/example/Foo.java

In this scenario, your Foo.java class depends on the bar.jar jar.

If you are using a project that does not use any dependency manager, it is quite complicated to work with.

I recommend taking a look at Maven or Gradle . They make it easier when you have external dependencies in the project.

    
25.06.2018 / 22:05