java»ñÈ¡µ±Ç°Â·¾¶[ת]
java»ñÈ¡µ±Ç°Â·¾¶[ת]
¹Ø¼ü×Ö: java ·¾¶
java »ñÈ¡µ±Ç°Â·¾¶
1 ¡¢ÀûÓà System.getProperty() º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
System.out.println(System.getProperty("user.dir"));//user.dir Ö¸¶¨Á˵±Ç°µÄ·¾¶
2 ¡¢Ê¹Óà File ÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
File directory = new File("");// É趨Ϊµ±Ç°Îļþ¼Ð
try{
System.out.println(directory.getCanonicalPath());// »ñÈ¡±ê×¼µÄ·¾¶
System.out.println(directory.getAbsolutePath());// »ñÈ¡¾ø¶Ô·¾¶
}catch(Exceptin e){}
File.getCanonicalPath() ºÍ File.getAbsolutePath() ´óÔ¼Ö»ÊǶÔÓÚ new File(".") ºÍ new File("..") Á½ÖÖ·¾¶ÓÐËùÇø±ð¡£
# ¶ÔÓÚ getCanonicalPath() º¯Êý£¬“ ." ¾Í±íʾµ±Ç°µÄÎļþ¼Ð£¬¶ø” .. “Ôò±íʾµ±Ç°Îļþ¼ÐµÄÉÏÒ»¼¶Îļþ¼Ð
# ¶ÔÓÚ getAbsolutePath() º¯Êý£¬Ôò²»¹Ü” . ”¡¢“ .. ”£¬·µ»Øµ±Ç°µÄ·¾¶¼ÓÉÏÄãÔÚ new File() ʱÉ趨µÄ·¾¶
# ÖÁÓÚ getPath() º¯Êý£¬µÃµ½µÄÖ»ÊÇÄãÔÚ new File() ʱÉ趨µÄ·¾¶
±ÈÈ統ǰµÄ·¾¶Îª C:\test £º
File directory = new File("abc");
directory.getCanonicalPath(); // µÃµ½µÄÊÇ C:\test\abc
directory.getAbsolutePath(); // µÃµ½µÄÊÇ C:\test\abc
direcotry.getPath(); // µÃµ½µÄÊÇ abc
File directory = new File(".");
directory.getCanonicalPath(); // µÃµ½µÄÊÇ C:\test
directory.getAbsolutePath(); // µÃµ½µÄÊÇ C:\test\.
direcotry.getPath(); // µÃµ½µÄÊÇ .
File directory = new File("..");
directory.getCanonicalPath(); // µÃµ½µÄÊÇ C:\
directory.getAbsolutePath(); // µÃµ½µÄÊÇ C:\test\..
direcotry.getPath(); // µÃµ½µÄÊÇ ..
¹ØÓÚSystem.getProperty·½·¨µÄ²ÎÊý¼û
System.getProperty
Ïà¹ØÎĵµ£º
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
Categories of Java HotSpot VM Options
Standard options recognized by the Java HotSpot VM are described on the Java Application Launcher reference pages for Windows
, Solaris
and Linux
. This document deals exclusively wit ......
1. W3C°Ñ±êÇ©ÄÚµÄÎı¾²¿·ÖÒ²¶¨Òå³ÉÒ»¸öNode
2.
Element¶ÔÏó´ú±íµÄÊÇXMLÎĵµÖеıêÇ©ÔªËØ
£¬¼Ì³ÐÓÚNode£¬ÒàÊÇNodeµÄ×îÖ÷ÒªµÄ×Ó¶ÔÏó
3. Attrʵ¼ÊÉÏÊǰüº¬ÔÚElementÖеģ¬Ëü²¢²»Äܱ»¿´×÷ÊÇElementµÄ×Ó¶ÔÏó£¬Òò¶øÔÚDOMÖÐAttr²¢²»ÊÇDOMÊ÷µÄÒ»²¿·Ö£¬ËùÒÔNodeÖÐµÄ getparentNode()£¬getpreviousSiblin ......
1¡¢Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orclΪÊý¾Ý¿âµÄSID
String user="test";
String password="test";
Connection conn= DriverManager.getC ......
ͬÊÂÒªÒ»¸öºÍAccess¹¦ÄÜÀàËÆµÄÈí¼þ£¬µ«ÊÇÒªÂú×ãËýÌá³öµÄ¸÷ÖÖÒªÇó¡£ËýÖªµÀÎÒÊÇ×öÈí¼þµÄ£¬ËùÒÔÈÃÎÒ¸øÐ´Ò»¸ö£¬ÏëÏëËýµÄÌáµÄÐèÇóºÜÈÝÒ×ʵÏÖ£¬ËùÒԾʹðÓ¦ÁË¡£ÒòΪAccessµÄ¹¦ÄÜËý¾ÍÓÃÀ´¹ÜÀí±í¸ñ£¬ÈÕ³£µÄºÜ¶à±í¸ñºÜ¶à£¬¶¼ÐèÒª½øÐеç×ÓµµµÄµÇ¼Ç¡£´ËÈí¼þ¿Ï¶¨ÒªÊµÏÖ±í¸ñ²Ù×÷µÄ¹¦ÄÜ£¬ËäÈ»¸ãJAVAÒѾ¿ìÁ ......
ÏÖÔÚµÄÎÒ°¡£¬»¹ÊǸöѧÉú£¬¸Õ¸ÕѧÁ˵ãVB£¬¶¯×÷×î´óÒ²¾ÍÊÇÓÃVB±àдÁËÒ»¸ö¼ÆËã½×³ËµÄ¹¤¾ß£¬Ëµ³öÀ´ÕæÊÇÈø÷λ¿´¹ÙЦµô´óÑÀ……µ«ÊÇÎÒͻȻÓÐÖÖÏë·¨£¬ÏëѧJava£¬±¾ÈËרҵÊÇͨÐŹ¤³Ì£¬¾õµÃÒÆ¶¯Í¨ÐÅ»áÓÐÏ൱´óµÄǰ;£¬ÓÚÊÇÃÈÉúÁËÕâ¸öÏë·¨£¡¸÷λ¿´¹Ù±ðЦ»°ÎÒ£¬ÄÜÌá°ÎµÄÌá°Îµã£¬²»ÄÜÌá°ÎµÄ¸øµã¹ÄÀø£¡ÔÚÏÂл¹ý¸÷λÁË£¡ ......