I want implement a timed pdf in java. Basically open a pdf and have it open for any number of seconds I desire and then close automatically after the time runs out. I tried running on a thread and putting the thread to sleep that didn't seem to help. I am stuck and I cant seem to find anything online that would help me.
package testing;
import java.awt.Desktop;
import java.io.File;
/**
*
* @author xxx
*/
public class PrimeThread implements Runnable {
String name;
int time;
public PrimeThread(String x)
{
name = x;
time = 30000;
}
@Override
public void run() {
try{
System.out.printf("%s os sleeping for %d\n", name, time);
try{
File fi = new File("C:\\Users\\xxx\\Downloads\\CBP Form 3078.pdf");
Desktop.getDesktop().open(fi);
}
catch(Exception ex){
}
Thread.sleep(time);
System.out.printf("%s is done\n", name);
}
catch(Exception e){
}
}