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

smtp of java mail

send mail use smtp .u can send text or html, send to many peoples if u have a email user and pwd and the smtp of the email which u use.
package org.lc.smtp;
import java.io.IOException;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.util.ByteArrayDataSource;
import com.sun.mail.smtp.SMTPTransport;
/**
* smtp send mail.
* @author lc.
*/
public class smtp {
Message message;
Properties properties = new Properties();
Session session;
/**
*
* @param from mail from
* @param pwd mail pwd
* @param host mail from smtp host
* @param to to someone's mail
*/
public smtp(String from, String pwd, String host, String to) throws MessagingException, IOException {
properties.put("mail.smtp.host", host);// set smtp properties
session = Session.getInstance(properties);
message = new MimeMessage(session);
message.setSubject("title of mail");// set titile
message.setText("text");//send text
message.setDataHandler(new DataHandler(new ByteArrayDataSource("<a href="\" mce_href="\""http://www.baidu.com\">ahaha..</a>".toString(), "text/html")));// send html
message.setfrom(new InternetAddress(from));// set send from
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to,false));// set send where

SMTPTransport t = (SMTPTransport) session.getTransport("smtp");
t.connect(host, from, pwd);
t.sendMessage(message, message.getAllRecipients());
}

public static void main(String[] args) throws Exception {
new smtp(args[0], args[1], args[2], args[3]);
}

}


Ïà¹ØÎĵµ£º

java¿ª·¢ÖÐMysqlÖÐÎÄÂÒÂëÎÊÌâµÄ½â¾ö

     MysqlÔÚĬÈÏÇé¿öϽ¨Á¢±íµÄ×Ö·û±àÂëÊÇlatin1£¬ËùÒÔÔÚ²åÈëÖÐÎÄʱ»á³ö´í¡£
eg£º
1¡¢²é¿´±í½¨Á¢µÄsqlÔ´Â룺
1: sqlÃüÁshow create table users
2:
3: ½á¹û£º
4: CREATE TABLE `users` (
5: `userID` int(10) unsigned NOT NULL AUTO_INCREMENT,
6: `userName` varchar(4 ......

JavaÅäÖÃÎļþ¶ÁÈ¡

JavaÅäÖÃÎļþ¶ÁÈ¡Óи÷ÖÖ²»Í¬µÄÎļþ£¬µ«ÊÇÓÉÓÚ´ò°üJarºóµÄ·¾¶¸Ä±ä£¬ÍùÍùÔÚÏîÄ¿ÖÐÄÜÕýÈ·¶ÁÈ¡µÄÅäÖÃÎļþÔÚJarºó±ä³ÉÎļþ²»´æÔڵı­¾ß£¬ÏÂÔÚÌá³ö¼¸¸÷²»Í¬µÄÅäÖÃÎļþ¶ÁÈ¡·½Ê½£¬½ö¹©²Î¿¼
Ò»¡¢Ö±½ÓÎļþ¶ÁÈ¡
File f = new File("you config file path");
FileReader fr = new FileReader(f);
BufferReader br = new ......

Java·þÎñÆ÷¶ËList¶ÔÏóת»»ÎªJSON¶ÔÏó²¢·µ»Ø¿Í»§¶ËʵÀý


Ò»¡¢Ê²Ã´ÊÇJSON
¡¡¡¡JSON ¼´ JavaScript Object Natation(Java¶ÔÏó±íʾ·¨)£¬ËüÊÇÒ»ÖÖÇáÁ¿¼¶µÄÊý¾Ý½»»»¸ñʽ£¬·Ç³£ÊʺÏÓÚ·þÎñÆ÷Óë JavaScript µÄ½»»¥¡£
¡¡¡¡¼ò¶øÑÔÖ®£¬JSON¾ÍÊÇJavaScript½»»»Êý¾ÝµÄÒ»ÖÖ¸ñʽ¡£Àý×ÓÈçÏ£º
{"username":"coolcooldool","password":"1230","usertype":"superadmin"}
{"list":[{"password": ......

java¶ÁÈ¡propertiesÊôÐÔÎļþÖµ·½·¨

ÔÚʹÓÃhibernate»òÕßspringµÄʱºò£¬ÎÒÃÇÍùÍùͨ¹ýÅäÖÃÎļþÅäÖÃÊý¾Ý¿âÁ¬½ÓÊôÐÔ¡£µ«Õâ´ÎÏîÄ¿Öв¢Ã»ÓÐÓõ½hibernateºÍspring£¬Ö»Óõ½ÁËstruts2¡£ÒªÈçºÎʵÏÖͨ¹ý¶ÁÈ¡ÎļþÅäÖûñÈ¡ÊôÐÔֵĨ£¿ResourceBundleÕâ¸öÀà¿ÉÊÇʵÏÖ¶ÁÈ¡propertiesÎļþÀ´»ñȡֵ
ÔÚjavaÖУº
public final static Object initLock = new Object();
privat ......

Ubuntu java¿ª·¢»·¾³´î½¨

jdkµÄ°²×°
1¡¢´Ójava.sun.com¸ãÏÂjdk×îеİ汾£¬Ò»°ãÎÒÃÇÓÃ1.6°æ±¾µÄ£¬ÏÂÔØbin¸ñʽµÄjdk£¬¼Ù¶¨ÏÂÔØµÄÎļþÃûΪjdk-6u20-linux-i586.bin¡£
2¡¢chmod u+x jdk-6u20-linux-i586.bin;È»ºó  ./jdk-6u20-linux-i586.bin ½âѹ£¬¼Ù¶¨½âѹºóµÄÎļþ¼ÐΪ jdk1.6_20;
3¡¢ÔÚ/usr/local/  ½¨Á¢Ò»¸öinstallµÄĿ¼£¬ È»ºó°Ñ½âÑ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ