简体   繁体   English

Jetty + intellij idea ::添加库

[英]Jetty + intellij idea :: add library

I get java.lang.NoClassDefFoundError when I add 3d party library to my project. 当我向项目中添加3d派对库时,我得到了java.lang.NoClassDefFoundError I've tried add libraries to web-inf/module dependencies/server libs, but it doesn't work. 我已经尝试将库添加到web-inf /模块依赖/服务器库,但它不起作用。 What the right way to add libraries to project using jetty and idea? 使用jetty和idea添加库到项目的正确方法是什么?

It's a two step process if you're using IntelliJ 9 or higher. 如果您使用IntelliJ 9或更高版本,这是一个两步过程。

Open the project structure and click on "libraries". 打开项目结构,然后单击“libraries”。 Add the directory containing the JARs you're interested in. 添加包含您感兴趣的JAR的目录。

Then click on "artifacts" and make sure that your libraries are in WEB-INF/lib of your deployment. 然后单击“artifacts”并确保您的库位于部署的WEB-INF / lib中。

If these are JARs that Jetty's server class loader has to have before your app loads (eg JDBC driver JARs for connection pooling), you'll have to add them to the Jetty server /lib instead of putting them in your app's WEB-INF/lib. 如果这些是Jetty的服务器类加载器在加载应用程序之前必须具有的JAR(例如用于连接池的JDBC驱动程序JAR),则必须将它们添加到Jetty服务器/ lib而不是将它们放入应用程序的WEB-INF /库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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