Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; public class Main { public static String getLastLine(String fname) { String lastLine; try { FileInputStream in = new FileInputStream(fname); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine = null, tmp; while ((tmp = br.readLine()) != null) { strLine = tmp; } lastLine = strLine; in.close(); } catch (Exception e) { lastLine = "70-01-01 00:00:00"; } return lastLine; } }