NetBeans建立Application專案時要建立Run Jar file只需要以下幾個步奏:
1.專案目錄右鍵選擇Properties

相關JavaMail的介紹可以參考Java程式Mail、EDM(電子型錄)寄送
最近使用synology架設了mail server,然後利用Let’s Encrypt加載了SSL功能,所以改寫了寄送郵件的程式。
有關synology架mail server部份可以參考
Let’s Encrypt安裝的部份可以由synology自動取得。
java function的宣告方式如下圖:
如無回傳型能則使用void。使用return 內容,來回傳執行結果。

要呼叫使用此function method時,先(new 物件類別).方法名稱(傳入參數…)就可以了 Read More
package yku;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
public class DateUtils {
	private static SimpleDateFormat datetimeformat = new SimpleDateFormat(
			"yyyy/MM/dd HH:mm:ss");
	private static SimpleDateFormat dateformat = new SimpleDateFormat(
			"yyyy/MM/dd");
	public static Timestamp convertDate(String str) {
		if (str == null || str.length() == 0)
			return null;
		try {
			return new Timestamp(dateformat.parse(str).getTime());
		} catch (Exception e) {
			//e.printStackTrace();
		}
		return null;
	}
	public static Timestamp convertDateTime(String str) {
		if (str == null || str.length() == 0)
			return null;
		try {
			return new Timestamp(datetimeformat.parse(str).getTime());
		} catch (Exception e) {
			//e.printStackTrace();
		}
		return null;
	}
	public static void main(String args[]) {
		System.out.println("1."+DateUtils.convertDate("2014/01/01").toString());
		System.out.println("2."+(DateUtils.convertDate("2014/0101")==null?"錯誤日期格式":"正確日期格式"));
		System.out.println("這裡是分割線---------------------------------------------------");
		System.out.println("3."+DateUtils.convertDateTime("2014/01/01 12:33:21").toString());
		System.out.println("4."+(DateUtils.convertDate("2014/0101 123321")==null?"錯誤日期時間格式":"正確日期時間格式"));
		
	}
}
Ans:
1.2014-01-01 00:00:00.0 2.錯誤日期格式 這裡是分割線--------------------------------------------------- 3.2014-01-01 12:33:21.0 4.錯誤日期時間格式
在安裝Eclipse、tomcat及建立專案與程式後,再來就需要啟動及設定Server來執行剛才的測試程式。
一.設定Tomcat
設定server.xml,把專案目錄的WebContent加入Content裡,啟動tomcat時啟會自動專入專案。
tomcat目錄下的confi/server.xml
<Context path="/MyWeb" docBase="C:\workspace\MyWeb\WebContent" debug="0" crosscontext="true" reloadable="true">
    <Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="true">
          <Store className="org.apache.catalina.session.FileStore"/>
    </Manager>
</Context>
其中SaveOnRestart=true時,自動Complier後會自動重新載入,並且自動回復Session,如果有登入機制則不會被導出。
path是web url的subDir名稱,docBase則選擇專案目錄下的WebContent就可以了
