目前我做了以下事情:
>在我的项目的根目录中创建了一个lib目录@H_301_5@>将相关的罐子复制到那个目录@H_301_5@>我的项目 – >属性 – > Java构建路径 – >添加罐子,我添加了该目录中的所有罐子.
jar will not be exported or published. runtime ClassNotFoundExceptions may result
解决方法
> a simple refresh期:
Can you switch to the navigator view,right-click refresh the project,make sure it’s not in the
LIB
dir,@H_301_5@ Then try and drag and drop the JAR into thelib
dir and see if it shows up.
>流程问题(从cached blog entry开始,original one不可用):
When you have total control of you web container/app server,deploying jar files is as easy as dropping the folder in your common lib folder.@H_301_5@ If you don’t package your web apps as a
war
file then it’s even easier because you only have to drop the jars in theWEB-INF/lib
folder of your webapp.@H_301_5@ But if you don’t have total control of your web server or application server,your only choice is to package the jars you’ve used with your war file.While developing a web project using my recently developed utility(a jar file),I encountered a
NoClassDefFound
error. Of course,it’s pretty obvIoUs that the jar file I’ve made and using on my web project could not be found (not visible in theCLASSPATH
).@H_301_5@ Adding the jar to the build path only eliminated the compilation problem. Dragging the jar file into the lib folder of my Eclipse workspace isn’t a very good idea.@H_301_5@ It took me a couple of hours before I figured out the solution:
- Right Click on your web project
- Click Properties
- Select J2EE Module Dependencies
- Click the Web Libraries Tab
- Add external jars (if the jar is outside of your project). An entry will be added under
Jar/Module
,make sure you click on the checkBox (checked).And everything should be fine. I tried exporting to a war file and then checked the content and my jar files are indeed deployed with the war.
>项目配置问题
I resolved the issue by:
- adding a “Web App Libraries” library in “java build path” and
- adding all the relevant jars into
WebContent/WEB-INF/lib