Re: Run Windows' command in Java method
Xiaojing, The API you're looking for is java.lang.Runtime. However, my personal advice would be to use OS-dependent calls sparingly - it makes your application platform dependent and typically makes it a lot less portable... Cheers, - Johan --- Johan Krisar johan.krisar(at)depicta.com - At 11:41 2003-08-15 +0800, Cui Xiaojing-a13339 wrote: Hello All, Do you know if windows' command could be executed in Java method? If yes, which API class method can be used to do it? Thanks a lot. Regards, Xiaojing
Using an Extra CharsetProvider in a Servlet
I'm messing around with character sets and character set conversions, and have a problem getting it to work in servlets. Installing an additional Charset requires entries in the file java.nio.charset.spi.CharsetProvider in META-INF/services. My problem is in understanding exactly WHAT META-INF directory I should place this file in... So far, the only way I've been able to get things to work properly, is to unpack the $CATALINA_HOME/bin/bootstrap.jar, add my Charset, CharsetProvider, CharsetEncoder and CharsetDecoder classes to it, change the META-INF, and re-pack the bootstrap jar. However, this does seem a rather hacky way to get things working... Actually, I found that James Manger had exactly the same problem about a year ago. I include his original posting, as it formulates the problem rather well: I would like to use a non-standard character set for selected operations within a servlet. I have implemented a CharsetProvider, Charset, CharsetEncoder CharsetDecoder. I can use my new character set from a Java application by listing the CharsetProvider class name in the following file within the application JAR. META-INF/services/java.nio.charset.spi.CharsetProvider (see API for CharsetProvider) My application (without any particular import statements) can make calls such as: String msg = Hello, World!; byte[] encoding = msg.getBytes(MY-CHARSET); I cannot get these lines to work in a servlet -- the msg.getBytes(MY-CHARSET) throws: java.nio.charset.UnsupportedCharsetException: MY-CHARSET QUESTION: How do I tell the system running my servlet about my character set? Adding a JAR with the character set (and META-INF... file) to the jre/ext/ directory makes the character set available to all Java apps - but not to the servlet! Adding the JAR to tomcat/common/lib/ did not seem to work either. My servlet can see my CharsetProvider class, but my CharsetProvider is not registered with the system (and it needs to be registered for String.getBytes(MY-CHARSET) to work). [JWSDP 1.0_01, J2SE 1.4.0_01, Tomcat 4.1.2, SunOS 5.6] James Manger Unlike James, I'm using J2SE 1.4.1_02-b06, Tomcat 4.1.18 and RedHat 8.0. Happy for any clue anyone may be able to provide! Cheers, - Johan --- Johan Krisár, johan.krisar(at)depicta.com
Re: TR : how to delete log files
Not sure if there are any automatic ways of doing so. If you're using Unix (or Linux), I'd suggest using find and cron. Have a look at the man pages for find, cron and crontab. Cheers, - Johan --- Johan Krisar johan.krisar(at)depicta.com - At 15:37 2003-08-14 +0200, you wrote: Is there a way in TOMCAT to delete automatically and regularly log files created in tomcat/logs directory - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OFF TOPIC: Book suggestion.
Hi Russ! Ok. Off topic again, but still... I'd recommend Core J2EE Patterns, Best Practices and Design Strategies. I've recently gotten my hands on the second edition, and it contains some very useful stuff. Seems to me the authors Alur, Crupi and Malks have done a good job of capturing useful patterns, practices and strategies in the J2EE realm. http://www.amazon.com/exec/obidos/tg/detail/-/0131422464/qid=1060844457/sr=1-1/ref=sr_1_1/103-0676276-3327837?v=glances=books Cheers, - Johan --- Johan Krisar johan.krisar(at)depicta.com - At 12:31 2003-08-13 -0400, Pitre, Russell wrote: Sorry for the off topic question, but I feel this list could benefit from the responses to this question (if they get answered).. Does anyone know of any good books on design patterns concerning MVC and Java and the like.Here's one by the gang of four but it was published in 1995...I would like to find one that is more current..anyone have any suggestions? http://www.amazon.com/exec/obidos/ASIN/0201633612/qid=1060790696/sr=2-1/ ref=sr_2_1/103-2315139-4279867 Thanx- Russ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]