Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java ¶ÁÈ¡ÊôÐÔÎļþ

// messages.hello.properties
id=001
name=ϧԵ
love=I think,therefor i am.
friends=Hi! {0} and {1} ,how are you?
// org.PropertiesUtil.java
package org;
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class PropertiesUtil {
private static String encoding = "UTF-8";
/**
* read the message with key from the resource bundle
* @param bundlePath
* @param key
* @return
*/
public static String getString(String bundlePath,String key){
return getString(bundlePath,key,null);
}
/**
* read the message with key from the resource bundle
* @param bundlePath
* @param key
* @param args
* @return
*/
public static String getString(String bundlePath,String key,Object[] args){
// we will throw a MessingResourceException if the bundle name is invalid
ResourceBundle bundle = getBundle(bundlePath);
try{
String msg = bundle.getString(key);
if(msg == null){
return "";
}
// change the message encoding
msg = convertISO(msg);
return msg = MessageFormat.format(msg, args);
} catch(MissingResourceException e){
return "";
}
}
/**
* get ResourceBundle with bundlePath
* @param bundlePath
* @return
* @throws MissingResourceException if resource is messing
*/
private static ResourceBundle getBundle(String bundlePath){
Locale locale = Locale.getDefault();
ResourceBundle bundle = ResourceBundle.getBundle(bundlePath,locale,getClassLoader());
return bundle;
}
/**
* get the current ClassLoader
* @return
*/
protected static ClassLoader getClassLoader(){
return PropertiesUtil.class.getClassLoader();
}
/**
* convert msg encoding
* @param msg
* @return
*/
public static String convertISO(String msg){
if(msg != null){
try{
return new String(msg.getBytes("iso-8859-1"),getEncoding());
} catch(


Ïà¹ØÎĵµ£º

ubntuÏÂjavaÖÐÎÄÂÒÂë½â¾ö

cd /usr/lib/jvm/java
-1.5.0-sun-1.5.0.15/jre/lib/fonts
sudo mkdir fallback
cd fallback
sudo cp /usr/share/fonts/truetype/arphic/uming.ttc /usr/lib/jvm/java
-1.5.0-sun-1.5.0.15/jre/lib/fonts/fallback
sudo mkfontdir
sudo mkfontscale ......

java mysqlÁ¬½ÓÊý¾Ý¿â´úÂë

package com.lovo.cq.shopping10_1.common;
import java.sql.*;
public class DbUtil {
private PreparedStatement pstmt = null;
private Connection con = null;
public DbUtil() {
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://l ......

¾ÞÈËÍøÂçjava±ÊÊÔ»ù´¡Ìâ

1¡¢StringÊÇ×î»ù±¾µÄÊý¾ÝÀàÐÍÂð?
»ù±¾Êý¾ÝÀàÐͰüÀ¨byte¡¢int¡¢char¡¢long¡¢float¡¢double¡¢booleanºÍshort¡£
java.lang.StringÀàÊÇfinalÀàÐ͵ģ¬Òò´Ë²»¿ÉÒԼ̳ÐÕâ¸öÀà¡¢²»ÄÜÐÞ¸ÄÕâ¸öÀࡣΪÁËÌá¸ßЧÂʽÚÊ¡¿Õ¼ä£¬ÎÒÃÇÓ¦¸ÃÓÃStringBufferÀà
2¡¢int ºÍ Integer ÓÐÊ²Ã´Çø±ð
Java ÌṩÁ½ÖÖ²»Í¬µÄÀàÐÍ£ºÒýÓÃÀàÐͺÍԭʼÀàÐÍ£¨ ......

²»´íµÄ¾­µäÎÄÕ£ºjavaÌáËÙ

JavaÓïÑÔÌØ±ðÇ¿µ÷׼ȷÐÔ£¬µ«¿É¿¿µÄÐÐΪҪÒÔÐÔÄÜ×÷Ϊ´ú¼Û¡£ÕâÒ»ÌØµã·´Ó³ÔÚ×Ô¶¯ÊÕ¼¯À¬»ø¡¢ÑϸñµÄÔËÐÐÆÚ¼ì²é¡¢ÍêÕûµÄ×Ö½ÚÂë¼ì²éÒÔ¼°±£ÊصÄÔËÐÐÆÚͬ²½µÈµÈ·½Ãæ¡£¶ÔÒ»¸ö½âÊÍÐ͵ÄÐéÄâ»úÀ´Ëµ£¬ÓÉÓÚĿǰÓдóÁ¿Æ½Ì¨¿É¹©ÌôÑ¡£¬ËùÒÔ½øÒ»²½×è°­ÁËÐÔÄܵķ¢»Ó¡£
“ÏÈ×öÍêËü£¬ÔÙÖð²½ÍêÉÆ¡£ÐÒºÃÐèÒª¸Ä½øµÄµØ·½Í¨³£²»»áÌ«¶à¡£”£¨ ......

Ãô½Ý¿ª·¢Öбàд¸ßÖÊÁ¿Java´úÂë

Ãô½Ý¿ª·¢Öбàд¸ßÖÊÁ¿Java´úÂë
2010-03-08 10:32
 | 
1709
´ÎÔĶÁ
 | 
¡¾ÒÑÓÐ9
ÌõÆÀÂÛ¡¿·¢±íÆÀÂÛ
À´Ô´£º±ÈÌØÍø À´Ô´£ºIBM/ÍõÓÀ¿ý
 | 
Êղص½ÎÒµÄÍøÕª
Ãô½Ý¿ª·¢µÄÀíÄîÒѾ­Á÷ÐÐÁ˺ܳ¤µÄʱ¼ä£¬ÔÚÃô½Ý¿ª·¢ÖеĿª·¢µü´ú½×¶ÎÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÎå¸ö²½Ö裬À´ÓÐЧµÄÌá¸ßÕû¸öÏîÄ¿µÄ´úÂëÖÊÁ¿¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ