summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/WebStartTest2.java
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/hjp5/examples/WebStartTest2.java
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/WebStartTest2.java')
-rw-r--r--Master/Reference Architectures and Patterns/hjp5/examples/WebStartTest2.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/WebStartTest2.java b/Master/Reference Architectures and Patterns/hjp5/examples/WebStartTest2.java
new file mode 100644
index 0000000..43c383f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/hjp5/examples/WebStartTest2.java
@@ -0,0 +1,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);
+ }
+} \ No newline at end of file