public class Server {
+ static long jarFileTime = 0;
+ static long bitFileTime = 0;
+ static {
+ try {
+ jarFileTime = new File("fleet.jar").lastModified();
+ bitFileTime = new File("build/fpga/main.bit").lastModified();
+ } catch (Exception e) { throw new RuntimeException(e); }
+ }
+
public static ServerSocket ss;
public static void main(String[] args) throws Exception {
System.err.println("programming...");
Process proc = Runtime.getRuntime().exec(new String[] {
- "/afs/megacz.com/work/ml410/program.sh",
- "/afs/megacz.com/work/ml410/main.bit"
+ "misc/program.sh",
+ "build/fpga/main.bit"
});
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String str = null;
return;
}
System.err.println("done programming.");
+ new Thread() {
+ public void run() {
+ try {
+ while(true) {
+ Thread.sleep(500);
+ if (jarFileTime != new File("fleet.jar").lastModified()) {
+ System.err.println("jarfile modified; exiting...");
+ System.exit(0);
+ }
+ if (bitFileTime != new File("build/fpga/main.bit").lastModified()) {
+ System.err.println("bitfile modified; exiting...");
+ System.exit(0);
+ }
+ }
+ } catch (Exception e) { throw new RuntimeException(e); }
+ }
+ }.start();
ss = new ServerSocket(3133);
while(true) {
try {