简体   繁体   中英

How to use Java package in eclipse

I am beginner of Java.

I want to use Java package here https://github.com/htorun/dbtableprinter

But I am not sure where I should put the download file. Using command prompt or eclipse, I want to use the package.

You have several options:

  1. To add the *.java& file to your project, I would do it in a *helper8 folder/package where you can use it with import (package) or helper-folder-name]/java-file-name . Like @Phil suggested in the previous answer.
  2. put your class in a project and use it as a dependency in your project.

This looks to just be a Java file. So instead of adding it like you would a package, you would just add the DBTablePrinter.java file into your program. Then you should be able to use the static helper methods.

I would probably put this in a "helper" folder. Then you should be able to either import it, or just do "helper/DbTablePrinter.printTable();"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM