1

I downloaded a package from the internet (specifically https://github.com/fusesource/jansi)

I want to access its classes by using the import keyword, just like how you would import java's classes without putting them in the same package.
I want to do something like:

import downloadedPackage.Class;

that way, i can access the class without putting it in the same package as my program. Now the problem is, I don't know where to put the downloaded package, such that java would recognize the package if I import it.

I have searched the net for this but they suggest to put the class in the same package, which is not what i want.

I'm using eclipse btw, thanks in advance!

EDIT: I know that in eclipse, you can add a package, but an IDE independent solution would be great, since we are doing a collab group project in class, and not each of us are using Eclipse. Thanks

imaginate
  • 49
  • 10
  • Add it to the classpath – Kon Mar 21 '16 at 15:17
  • thanks, but as i said in the edit, i want it to be an IDE independent solution. – imaginate Mar 21 '16 at 15:19
  • The `classpath` is an IDE-independent concept which an IDE creates a nice GUI interface for. You can still do everything from the command line – Kon Mar 21 '16 at 15:21
  • Ohhh, okay thanks for the info! I'm going to do more research now – imaginate Mar 21 '16 at 15:25
  • This thread should help set your classpath if you want to add a JAR or two: http://stackoverflow.com/questions/219585/setting-multiple-jars-in-java-classpath – Kon Mar 21 '16 at 15:26
  • You can put the library/jar anywhere and just need to put it on the classpath. You might want to look into build systems like Gradle or Maven which can be integrated into all major IDE's as well as work on the command line. Those would make handling dependencies (libraries/"packages") easier. – Thomas Mar 21 '16 at 15:28
  • Thanks, but one last question tho, If i set my classpath, its true to all projects and not just my current project, right? – imaginate Mar 21 '16 at 15:28
  • You have to set your classpath for each project you're working on seperately before building/executing – Kon Mar 21 '16 at 16:12
  • 1
    Bummer, I was hoping the settings would be saved to all. But anyway, thanks! I got this thing working now – imaginate Mar 21 '16 at 16:16

0 Answers0