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

ÇëÉ÷ÓÃjavaµÄFile#renameTo(File)·½·¨

ÒÔǰÎÒÒ»Ö±ÒÔΪFile#renameTo(File)·½·¨ÓëOSÏÂÃæµÄ move/mv ÃüÁîÊÇÏàͬµÄ£¬¿ÉÒÔ´ïµ½¸ÄÃû¡¢Òƶ¯ÎļþµÄÄ¿µÄ¡£²»¹ýºóÀ´¾­³£·¢ÏÖÎÊÌ⣺File#renameTo(File)·½·¨»á·µ»ØÊ§°Ü(false)£¬ÎļþûÓÐÒÆ¶¯£¬Óֲ鲻³öÔ­Òò£¬ÔÙºóÀ´¸É´àÆúÓø÷½·¨£¬×Ô¼ºÊµÏÖÒ»¸öcopy·½·¨£¬ÎÊÌâµ¹ÊÇÔÙҲûÓгöÏÖ¹ý¡£
×òÌìÀϰåͬѧÓÖÓöµ½Õâ¸öÎÊÌ⣬File#renameTo(File)·½·¨ÔÚwindowsÏÂÃæ¹¤×÷µÄºÃºÃµÄ£¬ÔÚlinuxÏÂż¶ûÓÖʧÁéÁË¡£»Øµ½¼ÒÎÒɨÁËÒ»±éJDKÖÐFile#renameTo(File)·½·¨µÄÔ´´úÂ룬·¢ÏÖËüµ÷ÓõÄÊÇÒ»¸ö±¾µØµÄ·½·¨(native method)£¬ÎÞ·¨ÔÙ¸ú×ÙÏÂÈ¥¡£ÍøÉÏÓÐÈË˵¸Ã·½·¨ÔÚwindowÏÂÊÇÕý³£µÄ£¬ÔÚlinuxÏÂÃæÊDz»Õý³£µÄ¡£Õâ¸öºÜÄÑ˵ͨ£¬SUN²»¿ÉÄܸã³öÕâÖÖÆ½Ì¨²»Ò»ÖµĴúÂë³öÀ´°¡¡£
ºóÃæÔÚSUNµÄ¹Ù·½ÂÛ̳ÉÏ¿´µ½ÓÐÈËÌáµ½Õâ¸öÎÊÌâ“works on windows, don't work on linux”£¬ºóÃæÓÐÈ˻ظ´ËµÊÇ“file systems”²»Ò»Ñù¡£¾¿¾¹Ôõô²»Ò»ÑùÄØ£¿»¹ÊÇûÓÐÏë³öÀ´...
ºóÃæÔÚÒ»¸öÂÛ̳ÀïÃæ·¢ÏÖÁËijÈ˹ØÓÚÕâ¸öÎÊÌâµÄ²ûÊö£º
ÒýÓÃ
In the Unix'esque O/S's you cannot renameTo() across file systems. This behavior is different than the Unix "mv" command. When crossing file systems mv does a copy and delete which is what you'll have to do if this is the case.
The same thing would happen on Windows if you tried to renameTo a different drive, i.e. C: -> D:
ÖÕÓÚÃ÷°×¿©¡£
×ö¸öʵÑ飺
Java´úÂë
  
File sourceFile = new File("c:/test.txt");   
File targetFile1 = new File("e:/test.txt");   
File targetFile2 = new File("d:/test.txt");   
System.out.println("source file is exist? " + sourceFile.exists()   
    + ", source file => " + sourceFile);   
System.out.println(targetFile1 + " is exist? " + targetFile1.exists());   
System.out.println("rename to " + targetFile1 + " => "  
    + sourceFile.renameTo(targetFile1));   
System.out.pr


Ïà¹ØÎĵµ£º

javaÖÐÈçºÎʹÓÃamcharts


×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......

ÎÒµÄJavaÑéÖ¤¹¤¾ßÀà

package com;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
public class RegexUtil {
private static Pattern PATTERN_EMAIL = Pattern
.compile("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$");// ÓʼþµØÖ·
private static Pattern PATTERN_TEL = Pattern
.compi ......

Java ÖÐSerializableµÄ×÷ÓÃ

MVCÖÐ java bean¾­³£ÓÃÕâ¸ö.
----
ûÓÐimplements Serializable£¬Äã¾Í²»ÄÜͨ¹ýrmi(°üÀ¨ejb)ÌṩԶ³Ìµ÷Óá£
serialization ÔÊÐíÄ㽫ʵÏÖÁËSerializable½Ó¿ÚµÄ¶ÔÏóת»»Îª×Ö½ÚÐòÁУ¬ÕâЩ×Ö½ÚÐòÁпÉÒÔ±»ÍêÈ«´æ´¢ÒÔ±¸ÒÔºóÖØÐÂÉú³ÉÔ­À´µÄ¶ÔÏó¡£
serialization²»µ«¿ÉÒÔÔÚ±¾»ú×ö£¬¶øÇÒ¿ÉÒÔ¾­ÓÉÍøÂç²Ù×÷£¨¾ÍÊÇèС˵µÄRMI£©¡£ ......

javaÖÐPropertiesÀàµÄʹÓÃ

ÔÚjava.util °üÏÂÃæÓÐÒ»¸öÀà Properties£¬¸ÃÀàÖ÷ÒªÓÃÓÚ¶ÁÈ¡ÒÔÏîÄ¿µÄÅäÖÃÎļþ£¨ÒÔ£®properties½áβµÄÎļþºÍxmlÎļþ£©¡£
PropertiesµÄ¹¹Ô캯ÊýÓÐÁ½¸ö£¬Ò»¸ö²»´ø²ÎÊý£¬Ò»¸öʹÓÃÒ»¸öProperties¶ÔÏó×÷Ϊ²ÎÊý¡£
ʹÓÃProperties¶ÁÈ¡£®propertiesÎļþ
test.propertiesÎļþÈçÏ£º
#²âÊÔ»·¾³ÅäÖãºÆ½Ì¨Â·¾¶ÅäÖÃ
jstrd_home=D:/T ......

JavaµÄһЩ»ù±¾ÖªÊ¶

Ò». Êý×é
  . ÕýÈ·µÄ¶¨Òå: int num[];   num= new int[5]       //Ö»ÓÐÓÃnew¹Ø¼ü×ÖÕæÕý´´½¨Êý×éʱ²Å¿ÉÒÔ¸ø¶¨ËüµÄ´óС
    ´íÎóµÄ¶¨Òå: int num[5];
  . ³£¼ûµÄÊý×é´íÎóΪ : ArrayIndexOutOfBoundsException  (Êý×éÔ½½ç´íÎó)
  . Êý×éµÄά¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ