Java Web Start使用log4j.properties文件的方法

news/2024/7/4 0:48:26 标签: java, web, properties, url, log4j, class
class="baidu_pl">
class="article_content clearfix">
class="htmledit_views">

在使用Java Web Start时,有一些资源如图片、class="tags" href="/tags/PROPERTIES.html" title=properties>properties文件等,不能得到更新。需要将这些文件打包成jar文件,这样才能通过jws更新和运行。

一.使用class="tags" href="/tags/LOG4J.html" title=log4j>log4j.class="tags" href="/tags/PROPERTIES.html" title=properties>properties,打包后,通过下面的语句:

URL class="tags" href="/tags/URL.html" title=url>url = getClass().getResource("prop/class="tags" href="/tags/LOG4J.html" title=log4j>log4j.class="tags" href="/tags/PROPERTIES.html" title=properties>properties");
PropertyConfigurator.configure(class="tags" href="/tags/URL.html" title=url>url);

使用Log4j。

例如:
  Class c;
  Logger log = Logger.getLogger(c.getName());
  class="tags" href="/tags/URL.html" title=url>url = c.getResource("/com/wonder/conf/class="tags" href="/tags/LOG4J.html" title=log4j>log4j.class="tags" href="/tags/PROPERTIES.html" title=properties>properties");
  PropertyConfigurator.configure(class="tags" href="/tags/URL.html" title=url>url);
  log.debug("Test");

二.使用图片等资源。通过下面的语句完成
Icon icon  = new ImageIcon(getClass().getClassLoader().getResource("images/save.gif"));    


http://www.niftyadmin.cn/n/1140732.html

相关文章

javap工具

用javac Test.java 得到了Test.class文件,它由字节码组成,那么怎么才能看到编译后的字节码呢?--用javap -c Test > Test.bc即反汇编出了此文件的字节码,从中可以看出JVM究竟会执行怎样的操作码&#xff…

Linux系统声卡问题

问题:Linux系统中有声卡设备,但是听不到声音 一、声卡驱动没有安装 1、通过插拔声卡查出声卡驱动 2、在相应的kernel中编译内核 修改保存.config文件,然后进行编译 make -j 10 make modules make modules_install reboot重启机器后可以“lsmo…

stakeholder的翻译

stakeholder:共利益者 指的是受到某件事情的输出的影响或对输出负有某种责任的群体或个人。 共利益者可能包括项目经理、供方、顾客以及其他人。RUP中指的是涉众,与项目相关的方方面面。感谢我老婆记得。

swing事件中keypressed和keytyped的区别

如果是按shift,ctrl只出发keypress小毛背心: 那就是功能键的区别了qi: 回车触发keypress和keytypeF1-F12触发keypress

Linux系统不能解析域名

问题:正在使用的Linux系统突然有一天不能解析域名gus.xxxxxxxx.com? # ping gus.xxxxxxxx.com ping: unknown host gus-xxxxxxxx.com 解决方法: 1、查看/etc/hosts  # cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localh…

FocusTraversalPolicy定制焦点顺序

FocusTraversalPolicy是 JDK1.4 以后引入的用来定制焦点顺序的新特性 还是拿例子来说吧: public class MyIFrame extends JInternalFrame { ...... protected void setCompFocus(Component[] compFocus) { getContentPane().setFocusable(false); …

declare -A color

#!/bin/bash ## 声明变量 declare -A color # 定义颜色 # bc_color : background color color[red]"\e[1;31m" color[green]"\e[1;32m" color[yellow]"\e[1;33m" color[blue]"\e[1;34m" color[purple]"\e[1;35m" color[bc_r…

java web start 1.5版本跟踪日志的设置

在jws1.4版本中的jws的控制台中,有选择控制台输出日期到某个位置的文件的功能,但是在1.5中却找不到这个选项了,翻遍控制台也没有发现相关的设置,经过查找,发现设置规则有所变化。 F…