javaÖлñÈ¡Îļþ·¾¶µÄ¼¸ÖÖ·½Ê½
¹ØÓÚ¾ø¶Ô·¾¶ºÍÏà¶Ô·¾¶£º
¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸öURL¾ø¶Ô·¾¶¡£Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶£¨HTMLÖеÄÏà¶ÔĿ¼£©£¬ÀýÈ磺ÔÚServletÖУ¬"/"´ú±íWebÓ¦ÓõĸúĿ¼¡£ºÍÎïÀí·¾¶µÄÏà¶Ô±íʾ¡£ÀýÈ磺"./" ´ú±íµ±Ç°Ä¿Â¼,"../"´ú±íÉϼ¶Ä¿Â¼¡£ÕâÖÖÀàËƵıíʾ£¬Ò²ÊÇÊôÓÚÏà¶Ô·¾¶¡£ÁíÍâ¹ØÓÚURI£¬URL,URNµÈÄÚÈÝ£¬Çë²Î¿¼RFCÏà¹ØÎĵµ±ê×¼¡£RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax,(http://www.ietf.org/rfc/rfc2396.txt)2.¹ØÓÚJSP/ServletÖеÄÏà¶Ô·¾¶ºÍ¾ø¶Ô·¾¶¡£2.1·þÎñÆ÷¶ËµÄµØÖ··þÎñÆ÷¶ËµÄÏà¶ÔµØÖ·Ö¸µÄÊÇÏà¶ÔÓÚÄãµÄwebÓ¦ÓõĵØÖ·£¬Õâ¸öµØÖ·ÊÇÔÚ·þÎñÆ÷¶Ë½âÎöµÄ£¨²»Í¬ÓÚhtmlºÍjavascriptÖеÄÏà¶ÔµØÖ·£¬ËûÃÇÊÇÓÉ¿Í»§¶Ëä¯ÀÀÆ÷½âÎöµÄ£©
µÚÒ»ÖÖ£º
File f = new File(this.getClass().getResource("/").getPath());
System.out.println(f);
½á¹û:
C:\Documents%20and%20Settings\Administrator\workspace\projectName\bin
»ñÈ¡µ±Ç°ÀàµÄËùÔÚ¹¤³Ì·¾¶;
Èç¹û²»¼Ó“/”
File f = new File(this.getClass().getResource("").getPath());
System.out.println(f);
½á¹û£º
C:\Documents%20and%20Settings\Administrator\workspace\projectName\bin\com\test
»ñÈ¡µ±Ç°ÀàµÄ¾ø¶Ô·¾¶£»
µÚ¶þÖÖ£º
File directory = new File("");//²ÎÊýΪ¿Õ
String courseFile = directory.getCanonicalPath() ;
System.out.println(courseFile);
½á¹û£º
C:\Documents and Settings\Administrator\workspace\projectName
»ñÈ¡µ±Ç°ÀàµÄËùÔÚ¹¤³Ì·¾¶;
µÚÈýÖÖ£º
URL xmlpath = this.getClass().getClassLoader().getResource("selected.txt");
System.out.println(xmlpath);
½á¹û£º
file:/C:/Documents%20and%20Settings/Administrator/workspace/projectName/bin/selected.txt
»ñÈ¡µ±Ç°¹¤³ÌsrcĿ¼ÏÂselected.txtÎļþµÄ·¾¶
µÚËÄÖÖ£º
System.out.println(System.getProperty("user.dir"));
½á¹û£º
C:\Documents and Settings\Administrator\workspace\projectName
»ñÈ¡µ±Ç°¹¤³Ì·¾¶
µÚÎåÖÖ£º
System.out.println( System.getProperty("java.class.path"));
½á¹û£º
C:\Documents and Settings\Administrator\w
Ïà¹ØÎĵµ£º
Ô´´úÂ룺
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class brandishString extends Applet implements Runnable, MouseListener {
String str; // ÒªÏÔʾµÄ×Ö·û ......
import java.util.Properties;
import javax.mail.FetchProfile;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.internet.InternetAddress;
public class ReceiveMail
{
public ReceiveMai ......
ÆäʵʹÓÃmavenÒѾºÜ¾ÃÁË£¬´ÓÔçÆÚµÄ1.0.1µ½ÏÖÔÚµÄ2.0.6£¬Æäʵ¶ÔÓÚÒ»°ãÏîÄ¿¿ª·¢£¬³£ÓõÄÒ²¾ÍÊÇ´´½¨ÏîÄ¿(Create)¡¢¹¹½¨(Build)¡¢²âÊÔ(Test)¡¢·¢²¼(Release)¡£±¾ÎIJ¢²»ÊǹØÓÚmavenÈçºÎʹÓõÄÏêϸ½éÉÜ£¬¶øÖ»ÊÇÔÚʵ¼ÊÏîÄ¿¿ª·¢ÖеÄһЩ³£ÓûÒÔ¼°Ïà¹Ø²å¼þµÄʹÓÃ×ܽᣬÈç¹ûÄã¶ÔÓÚmavenÉв»Á˽⣬¿ÉÒÔÏÈÔÚ¹Ù·½ÍøÕ¾[Maven'site]¹ä¹ ......
½ñÌì·¢ÏÖÒ»¸öºÜNBµÄÍæÒ⣬ÈÃÎÒÃÇÔÚ¿ª·¢µÄʱºòÐÞ¸ÄJavaÎļþ£¬²»ÓÃÖØÆô·þÎñÆ÷Á¢¿ÌÉúЧ£¡Ö§³ÖJetty tomcat jbossµÈºÜ¶à·þÎñÆ÷£¬Ëü¾ÍÊÇJRebel¡£ http://www.zeroturnaround.com/jrebel/installation/ ÕâÀïÓÐÕë¶Ô²»Í¬·þÎñÆ÷µÄ°²×°·½·¨£¬»ù±¾ÉÏÖ÷Á÷µÄ¶¼º¸ÇÁË£¬¾ø´ó¶àÊý³ÌÐòÔ±¶¼ÄÜʹÓã¡ÎÒÃǹ«Ë¾ÓÃmaven/jetty¶ÔÏîÄ¿½øÐй¹½¨ºÍ¿ª ......
JavaɳÏäʵÏÖÊÇÖØдÀà¼ÓÔØÆ÷ºÍ°²È«¹ÜÀíÆ÷,ͨ¹ýÉèÖõÄÈ«¾Ö°²È«¹ÜÀíÆ÷À´¿ØÖÆÖ´ÐгÌÐòµÄȨÏÞ
˵Ã÷: °²È«²ßÂÔÖ»¶Ô°²×°°²È«¹ÜÀíÆ÷Ö®ºóµÄÀàÉúЧ,֮ǰµÄÀ಻Ôٴ˹ÜÀí·¶Î§Ö®ÄÚ,ÀûÓÃÕâÒ»µã¿ÉÒÔÔ¤ÏÈÉèÖÃÎÒÃÇÐèÒªµÄ²Ù×÷,¶ø¶Ôij¸öµãÖ®ºóµÄËùÓзǷ¨²Ù×÷½øÐÐȨÏÞÉèÖÃ.
Àà¼ÓÔØÆ÷ÖØд
/**
* [ÖØдµÄÀà¼ÓÔØÆ÷]
* ɳÏä³ÌÐòÀà¼ÓÔØÆ÷,¿ ......