linux·þÎñÆ÷ÎļþÉÏ´«µÄÎÊÌâ
ÎÒÏÖÔÚÓöµ½µÄÎÊÌâÊÇ :
ÎÒ¿ª·¢µÄʱºòÔÚ WINÏ¿ª·¢µÄ
ÎļþÉÏ´«µÄ¹¦ÄÜûÓÐÎÊÌâ µ«ÊÇÉÏ´«µ½·þÎñÆ÷ÉϾÍʲô·´Ó³Ò²Ã»ÓÐ
²»ÖªµÀÔõô»ØÊÂ?
String TMP_DIR =getServletContext().getRealPath("/")+"jsp/integrate/uploadfile/";
ÕâÊÇÎÒдµÄ·¾¶
²»ÖªµÀ¶Ô²»¶Ô ÌýÈ˼Ò˵linuxÎļþ·¾¶Ð´·¨ÊDz»Ò»ÑùµÄ??
Çó½Ì¸ßÈË
ÒªÊÇÓÐÔ´Âë¾Í¸üºÃÁË::
Äã´òӡһϣ¬TMP_DIR
LINUXϵÄÎļþ·Ö¸ô·ûÊÇ/,ÕâÒ»µãºÜÈÝÒ׳ö´í¡£
ÔÙÒ»¸ö£¬²éһϣ¬jsp/integrate....Ç°ÃæÓÐûÓÐ/
×¢ÒâһϷָô·ûµÄд·¨
File.separator ±íʾÎļþÖ®¼äµÄ·Ö¸ô·ûÊÇ¿çÆ½Ì¨µÄ
ѧϰ
ServletActionContext.getRequest().getRealPath("");
¿´ÄãµÄĿ¼½á¹¹ÁË, Èç¹û jspĿ¼ÔÚ webroot ÏÂÃæ, Ó¦¸ÃgetRealPath("/") ²»ÒªÕâ¸öб¸ÜµÄ.
´ó¶àÊÇ·¾¶ÎÊÌâ,ºÃºÃ¼ì²é¼ì²é!
ûÓнâ¾ö
ÕæµÄºÜ¹Ö
²»ÖªµÀÊDz»ÊÇÎÒÓõÄ×é¼þÓÐÎÊÌâ
ËÓÐÎÞ×é¼þÉÏ´«ÎļþµÄ´úÂëÂð?
ÄãÔÚLinuxÏ °Ñ ·¾¶´òÓ¡³öÀ´
ÄãÊÇÓõÄÄĸöÉÏ´«µÄ×é¼þ£¿
¼ÇµÃµ±³õÓиöÏîĿҲÓöµ½¹ýÕâ¸öÎÊÌâ¡£
¸ÄÓÃftp4che-0.6.2.jarÕâ¸ö²å¼þÊÔһϡ£
String tmpPath = "c:/tmpdir";
String savePath = request.getSession().getServletContext().getRealPath("/")+"uploadfile/"+type+"/"+studentid;
tmpDir = new File(tmpPath);
saveDir = new File(savePath);
if(!tmpDir.isDirectory())
tmpDir.mkdir();
if(!saveDir.isDirecto
Ïà¹ØÎÊ´ð£º
ÐèÒªÔÚlinuxÏÂÓÃÖжϷ½Ê½À´Ð´Ò»¸ö´®¿ÚµÄ³ÌÐò£¬ÏÖÔÚûÓÐ˼·£¬ÍøÉÏÓÐÈË˵ÓÃselect,signal,taskletº¯ÊýµÄ£¬µ«ÊÇÎÒû¿´¶®£¬Ï£ÍûÓÐ×ö¹ýµÄ¸øÒ»ÏÂÀý³Ì£¬¶àл£¡
¾ÍÊÇÄܹ»µ±´®¿ÚÊý¾ÝÀ´ÁÙʱ×Ô¶¯Í¨Öª´®¿Ú¶ÁÈ¡Êý¾Ý£¬ÀàËÆÓÚÖÐ ......
ÒòΪ°²×°cvsÒªÓõ½xinetd·þÎñ£¬·¢ÏÖ»úÆ÷ÉÏûÓС£¡£¾Í´ÓÍøÉÏÏÂÔØÁ˸ö×°ÉÏ£¬
SQL code:
[root@localhost ~]# rpm -qa xinetd
[root@localhost ~]# rpm -qa telnet
telnet-0.17-38.el5
[root@localhost ~]#
¸ ......
ljk@ubuntu:~/×ÀÃæ$ su
Password:
su: Authentication failure
ljk@ubuntu:~/×ÀÃæ$
ÈçÉÏ´íÎó£¬ÎªÊ²Ã´£¿
Authentication failure
ûÓÐÉèÖÃrootÃÜÂë°É
ÓÃÃüÁî
sudo passwd root
ÉèÖÃrootà ......
ÎÒÒª²éÕÒĿ¼/home/riverdream/ϵÄËùÓеģª.CPPÎļþ
int main(int argc, char *argv[])
{
char str[] = "/home/riverdream/";
DIR* pDir = NULL;
  ......