简体   繁体   中英

Importing joptimizer as external JAR file fails in eclipse

I'm trying to use the JOptimizer library ( http://www.joptimizer.com/ ). I've downloaded the .jar file and added it to the project by using the Project->Properties->Java Build Path->Libraries->Add External JARs.

I've then imported the relevant library, and Eclipse recognized the import:

import src.main.java.com.joptimizer.optimizers.*;

However, in project explorer, all the packages in the jar are showed as empty, and I'm not able to use any of the classes listed in the package's documentation: http://www.joptimizer.com/apidocs/index.html When I try to organize imports (ctrl-shift-o), the import disappears.

What could be wrong here?

There are actually 3 downloads available - one is XXX-sources.jar (the default), and XXX.jar, and XXX-dependencies.jar.zip are the other two. I had the same problem as you and fixed it by downloading the latter two files, unzipping the zip, and pointing to the contents of the zip and optimizer jar, NOT the sources jar.

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