首页 \ 问答 \ 在Eclipse中将源代码链接到.jars(Linking source to .jars in Eclipse)

在Eclipse中将源代码链接到.jars(Linking source to .jars in Eclipse)

这个框架分布包括一个lib文件夹(其中所有的二进制jar文件都在这里)和一个src文件夹(你可以在这里找到每个.jar的相应的.javas文件)。 到目前为止,我只在Java项目构建路径中添加了lib

你现在如何复制src ? 只是添加它或有某种方式链接lib ? 我不记得这个收益究竟是什么组成的,但我认为这样会更好一些。

编辑 - src作为文件夹层次结构提供,而不是源.jars。


This framework distribution includes a lib folder (where all the binary .jars are) and a src one (where you can find the corresponding .javas for each .jar). So far I only have added lib to the Java project build path.

How would you copy src now? Just adding it or is there a way of somehow link it to lib? I don't have in mind what the gain would exactly consist of but I reckon that that would be somewhat better.

Edit - src is provided as a folder hierarchy, not source .jars.


原文:https://stackoverflow.com/questions/6687150
更新时间:2023-04-12 22:04

最满意答案

你问了两个单独的问题(至少在Tomcat 7中,你问了两个单独的问题)。

Log4j2是Web应用感知的,所以它可以在每个Web应用程序中进行不同的配置。

虽然每个Web应用程序不能具有不同的系统属性(因为就其本质而言,系统意味着全局),但每个Web应用程序可以具有不同的程序员可访问属性,而不是系统属性。

将Tomcat 7配置为符合Servlet 3.0规范,您可以创建自己的ServletContainerInitializer,在所有其他初始化器之前将初始化器配置为首先初始化,然后在该初始化器中,您可以从文件,数据库或任何其他设备中读取设置否则将它们“停放”在ServletContext的属性集合中。 通常,初始化程序会检查它正在运行的系统,并根据它发现的内容设置属性。 从文件中读取它们毫无意义,因为您可以将它们放在web.xml中。 然后,您的Web应用程序中的代码可以将设置从Web应用程序的ServletContext属性集合的唯一实例中提取出来。 这允许每个Web应用程序或同一Web应用程序的每个实例进行唯一配置。


You're asking two separate questions (well, at least as of Tomcat 7 you are asking two separate questions).

Log4j2 is web app aware, so it can be configured differently in each web app.

And while you can't have different system properties for each web app (because by its very nature, system means global), you can have different programmer accessible properties per web app, just not system properties.

With Tomcat 7 configured to conform to the Servlet 3.0 specification, you can create your own ServletContainerInitializer, configure that initializer to be initialized first, before all other initializers, and then, within that initializer you can read settings out of a file, DB or anything else and "park" them in the ServletContext's attributes collection. Typically, your initializer would inspect the system it's running on and set the attributes based on what it discovers. There's little point in reading them from a file, since you could simply park them in web.xml. Then code in your web app can pull the settings out of the web app's unique instance of its ServletContext's attribute collection. This allows each web app, or each instance of the same web app, to be uniquely configured.

相关问答

更多
  • 您好,提问者: apache是一个开源的公司。 tomcat是一个web服务器。 7.0.57是tomcat版本号。
  • apache是web服务器,tomcat是应用(java)服务器,它只是一个servlet(jsp也翻译成servlet)容器,可以认为是apache的扩展。 apache和tomcat都可以做为独立的web服务器来运行。但是apache不能解释java程序(jsp,serverlet) Apache是普通服务器,本身只支持html即普通网页。不过可以通过插件支持PHP,还可以与Tomcat连通(单向Apache连接Tomcat,就是说通过Apache可以访问Tomcat资源。反之不然) 两者都是一种容器, ...
  • apache tomcat都是Web服务器软件,它们主要为Linux下JSP、PHP提供支持。 当然他们也有For Windows的版本。 和IIS一样,tomcat和apache是Linux下的主流而IIS是Windows平台下的。
  • tomcat是sun和apache合作, 做出来的jsp server, 支持servlet 和jsp.tomcat本身可以做为 web server, 当处理静态页面时,tomcat不如apache迅速,不象apache一样可配置,强壮. apache做为最流行的web服务器功能强大,高效,但并不支持jsp及servlet,所以通常的做法是把它们整合起来,让apache处理静态页面,而把动态页面的请求交给 tomcat处理,发挥各自的优势. 通过在apache中加载整合模块和进行设置,apache就能够根 ...
  • 你问了两个单独的问题(至少在Tomcat 7中,你问了两个单独的问题)。 Log4j2是Web应用感知的,所以它可以在每个Web应用程序中进行不同的配置。 虽然每个Web应用程序不能具有不同的系统属性(因为就其本质而言,系统意味着全局),但每个Web应用程序可以具有不同的程序员可访问属性,而不是系统属性。 将Tomcat 7配置为符合Servlet 3.0规范,您可以创建自己的ServletContainerInitializer,在所有其他初始化器之前将初始化器配置为首先初始化,然后在该初始化器中,您可以 ...
  • 您需要使用application.getResourceSettings().getStringResourceLoaders().add(...)添加新的IStringResourceLoader。 有关默认值,请参阅https://github.com/apache/wicket/blob/515e2be2a5301f5caf7b1baee4a593d21c20e275/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettin ...
  • 您可以在tomcat启动脚本中将该属性作为JVM的指令传递JAVA_OPTS =%JAVA_OPTS%-Dmy.custom.key = CustomKey You can pass the property as a directive for the JVM in your tomcat startup script JAVA_OPTS= %JAVA_OPTS% -Dmy.custom.key=CustomKey
  • 尝试在$ CATALINA_HOME / bin / catalina.sh中进行此配置: JAVA_HOME = / usr / lib中/ JAVA / jdk1.8.0_102 CATALINA_HOME = /选择/ Tomcat的/ Apache的Tomcat的8.5.4 把它作为文件的前两行,以便以后可以使用它。 希望能帮助到你 Try having this configuration inside your $CATALINA_HOME/bin/catalina.sh: JAVA_HOME= ...
  • 对于Tomcat服务,启动设置存储在注册表下的Options键下: HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\Tomcat\Parameters\Java (在需要的地方替换适当的Tomcat版本)。 编辑: 在64位Windows上,注册表项是: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Tom ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)