import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
public class TestCompileTime {
public TestCompileTime() {
try {
System.out.println("build date:>>"+TestCompileTime.getCompileTimeStamp(this.getClass()));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new TestCompileTime();
}
/**
* get date a class was compiled by looking at the corresponding class file in the jar.
* @author Zig
*/
public static Date getCompileTimeStamp( Class<?> cls ) throws IOException
{
ClassLoader loader = cls.getClassLoader();
String filename = cls.getName().replace('.', '/') + ".class";
// get the corresponding class file as a Resource.
URL resource=( loader!=null ) ?
loader.getResource( filename ) :
ClassLoader.getSystemResource( filename );
URLConnection connection = resource.openConnection();
// Note, we are using Connection.getLastModified not File.lastModifed.
// This will then work both or members of jars or standalone class files.
long time = connection.getLastModified();
return( time != 0L ) ? new Date( time ) : null;
}
}
· [벨소리] 미드라마 24 1시즌 오프닝 2007/01/10
· 싸이월드를 닮은 블로그 스킨 버전 0.1 2007/01/02
· 벤처 CEO가 키워주고 싶은 웹프로그래머 2007/04/04
· fedora 에서 scim에서 한글이 안될때... 2007/10/29
· 우분투 8.10 + XP 심리스 20081029일자 스크린샷 2008/10/29
· 우분투 설치 고려사항 (진행중) 2008/11/06
· me2day 버그 발견 ㅋ 2007/03/12
· CF Today Screen example 2006/10/25
· ThinkPad R52 공장 초기화하기 2007/05/04
· HP iPAQ rw6800 2007/01/25





