在何处放置JAR文件以避免冲突? [英] Where To Put JAR Files To Avoid Conflicts?
问题描述
Windows XP Pro
WebLogic 11g
Tomcat 7
JDK 1.6
Windows XP Pro WebLogic 11g Tomcat 7 JDK 1.6
我一直把补充JAR文件放在
I've been putting supplemental JAR files in
JAVA_HOME/jre/lib/ext ( a JDK installation )
多年。它比改变我的CLASSPATH更方便,我开发的所有东西都可以在一个地方访问一组东西。
for years. It is much more convenient than altering my CLASSPATH and everything I develop has access to one set of stuff in one place.
我需要一个不同或更好的方法。
I need a different or better approach though.
我最近在我的计算机上安装了WebLogic 11g。由于我不喜欢在我的机器上安装多个JDK或JVM,因此我将JAVA_HOME变量设置为指向那里。
I recently installed WebLogic 11g on on my computer. Since I do not like having multiple JDKs or JVMs on my machine I set my JAVA_HOME variable to point to there.
然后我将servlet-api.jar放在那里进行编译我的webapps。一切都很好。
I then put a servlet-api.jar there to compile my webapps. All was well.
然后我安装了Tomcat 7. Tomcat 7在CATALINA_HOME / lib中有自己的servlet-api.jar。在CATALINA_HOME / lib中有一个servlet-api.jar,在JAVA_HOME / jre / lib / ext中有一个导致Tomcat 7抛出错误。但是,我需要在JAVA_HOME / jre / lib / ext中编译我的webapps。
Then I installed Tomcat 7. Tomcat 7 has its own servlet-api.jar in CATALINA_HOME/lib. Having a servlet-api.jar in CATALINA_HOME/lib and one in JAVA_HOME/jre/lib/ext causes Tomcat 7 to throw errors. However, I need one in JAVA_HOME/jre/lib/ext to compile my webapps.
是否有比从CATALINA_HOME / lib删除servelt-api.jar更优雅的解决方案?
Is there a more graceful solution than deleting servelt-api.jar from CATALINA_HOME/lib ?
谢谢
推荐答案
不要将Jar放入 / ext
,但是根据您的实际EE框架进行编译。这样,当您的Tomcat(或其他EE安装)随附的 .jar
版本发生更改时,您将不会遇到问题。所以不要再将 .jar
放在ext中,并将构建路径更改为实际的 EE环境。
Don't put the Jar in /ext
, but compile against your actual EE framework. In that way you won't run into problems when the version of the .jar
s delivered with your Tomcat (or other EE installation) changes. So don't put the .jar
in ext anymore and change the build path to your actual EE environment.
这篇关于在何处放置JAR文件以避免冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!