blob: 43c383f995264a057704f3be76ee69bf3d1494d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* WebStartTest2.java */
import java.io.*;
import javax.jnlp.*;
public class WebStartTest2
{
public static void main(String[] args)
{
try {
//FileOpenService anfordern
FileOpenService fos = (FileOpenService)ServiceManager.lookup(
"javax.jnlp.FileOpenService"
);
//Datei�ffnen-Dialog aufrufen
FileContents fc = fos.openFileDialog(null, null);
if (fc == null) {
System.err.println("openFileDialog fehlgeschlagen");
} else {
//Dateiinhalt auf der Konsole ausgeben
InputStream is = fc.getInputStream();
int c;
while ((c = is.read()) != -1) {
System.out.print((char)c);
}
is.close();
}
} catch (UnavailableServiceException e) {
System.err.println("***" + e + "***");
} catch (IOException e) {
System.err.println("***" + e + "***");
}
//10 Sekunden warten, dann Programm beenden
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
System.exit(0);
}
}
|