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

JavaÈ¡µÃ´úÂëËùÔÚÐкŵķ½·¨

ÓÃCµÄÈËÒ»¶¨ÖªµÀ__FILE__ºÍ__LINE__,µ«ÊÇJavaÖÐ ²¢Ã»ÓÐÕâÑùµÄ¶¨Ò壬ÓÐʱºòµ÷ÊÔ¶àÏ߳̾ͺܲ»·½±ã£¬Ã»°ì·¨£¬×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ~ÓÃÏÂÃæµÄº¯ÊýÈ¡µÃµ±Ç°Ðкš£
º¯Êý£º
/**
*µÃµ½ExceptionËùÔÚ´úÂëµÄÐÐÊý
*Èç¹ûûÓÐÐÐÐÅÏ¢,·µ»Ø-1
*/
public static int getLineNumber(Exception e){
StackTraceElement[] trace =e.getStackTrace();
if(trace==null||trace.length==0) return -1; //
return trace[0].getLineNumber();
}
ʹÓÃÀý×Ó£º
System.out.println(“Current line:”+getLineNumber(new Exception()));


Ïà¹ØÎĵµ£º

Èý¡¢¶ÔjavaÐÂÊֵļ¸¸ö½¨Òé

    1¡¢Ñ§»áÔõôÉèÖû·¾³±äÁ¿
  ´ð°¸£ºÔÚÎҵĵçÄÔÀïÉèÖÃ
    2¡¢Ñ§»áÔõôÉèÖÃjava ³ÌÐòÊäÈë²ÎÊý
´ð°¸£ºmain ²ÎÊýÊý×é
    3   ѧ»áÔõôÉèÖà classpath·¾¶£¬ÒÔ¼°classpathÊǸÉôµÄ
´ð°¸£ºÒýÓõÄÀàµÄ·¾¶
   4    ÖªµÀjarÎÄ ......

java ÊÂÎñ´¦Àí

Èç¹û¶ÔÊý¾Ý¿â½øÐжà´Î²Ù×÷,ÿһ´ÎµÄÖ´Ðлò²½Ö趼ÊÇÒ»¸öÊÂÎñ.Èç¹ûÊý¾Ý¿â²Ù×÷ÔÚijһ²½Ã»ÓÐÖ´Ðлò³öÏÖÒì³£¶øµ¼ÖÂÊÂÎñʧ°Ü,ÕâÑùÓеÄÊÂÎñ±»Ö´ÐÐÓеľÍûÓб»Ö´ÐÐ,´Ó¶ø¾ÍÓÐÁËÊÂÎñµÄ»Ø¹ö,È¡ÏûÏÈÇ°µÄ²Ù×÷.....
JavaBeanÖÐʹÓÃJDBC·½Ê½½øÐÐÊÂÎñ´¦Àí
public int delete(int sID) {
¡¡ dbc = new DataBaseConnection();
¡¡ Connect ......

JavaÄÚ´æÒç³ö

´ÓÎïÀíÉϽ²£¬¶ÑÕ»¾ÍÊÇÒ»¶ÎÁ¬Ðø·ÖÅäµÄÄÚ´æ¿Õ¼ä¡£ÔÚÒ»¸ö³ÌÐòÖУ¬»áÉùÃ÷¸÷ÖÖ±äÁ¿¡£¾²Ì¬È«¾Ö±äÁ¿ÊÇλÓÚÊý¾Ý¶Î²¢ÇÒÔÚ³ÌÐò¿ªÊ¼µÄʱºò¾Í±»¼ÓÔØ¡£¶ø³ÌÐòµÄ¶¯Ì¬µÄ¾Ö²¿±äÁ¿Ôò·ÖÅäÔÚ¶ÑÕ»ÀïÃæ¡£
JVM¹ÜÀíÁ½ÖÖÀàÐ͵ÄÄڴ棬¶ÑºÍ·Ç¶Ñ¡£¶ÑÊǸø¿ª·¢ÈËÔ±ÓõÄÉÏÃæ˵µÄ¾ÍÊÇ£¬ÊÇÔÚJVMÆô¶¯Ê±´´½¨£»·Ç¶ÑÊÇÁô¸øJVM×Ô¼ºÓõģ¬ÓÃÀ´´æ·ÅÀàµÄÐÅÏ¢µÄ¡£Ëüº ......

java FTP²Ù×÷

 ¼òµ¥µÄдÁ˸öjava¶ÔftpµÄ²Ù×÷
ÓõÄÊÇcommons-net.jar°ü
FTPProxy.java
public class FTPProxy{
public FTPProxy()
{
super();
ftpClient = new FTPClient();
}
public FTPProxy(FTPBean entity)
{
this();
this.entity = entity;
}
private FTPBean entity;
private FTPClient ftpCli ......

JAVAʹÓÃEPollÀ´½øÐÐNIO´¦ÀíµÄ·½·¨

JDK 6.0 ÒÔ¼°JDK 5.0 update 9 µÄ nioÖ§³Öepoll £¨½öÏÞ Linux
ϵͳ
£©£¬¶Ô²¢·¢idle connection»áÓдó·ù¶ÈµÄÐÔÄÜÌáÉý£¬Õâ¾ÍÊǺܶàÍøÂç·þÎñÆ÷Ó¦ÓóÌÐòÐèÒªµÄ¡£
ÆôÓõķ½·¨ÈçÏ£º
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.EPollSelectorProvider
ÀýÈçÔÚ Linux ÏÂÔËÐÐµÄ Tomcat ʹÓà NIO Connector £¬ÄÇôÆô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ