Skip to content

Commit 58c7946

Browse files
committed
ADAP-142: Fixed issue with missing RVM
1 parent c0c7b8c commit 58c7946

5 files changed

Lines changed: 13 additions & 14 deletions

File tree

release/OpenFinRVM.jar

-3 MB
Binary file not shown.

release/docking.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
REM batch to run Docking example of OpenFin and Java windows with Layout service.
22
REM layout.html is a simple example of OpenFin window that uses Layout service.
33
REM For this example to work, layout.html needs to be hosted by a web server and its URL needs to be configured with -Dcom.openfin.demo.layout.url
4+
REM To set RVM path, add -Dcom.openfin.demo.layout.rvm=C:\Users\username\AppData\Local\OpenFin\OpenFinRVM.exe
45

5-
java -cp openfin-desktop-java-example-7.1.1.jar;openfin-desktop-java-adapter-7.1.1-SNAPSHOT.jar;openfin-snap-dock-1.0.0.1.jar;TableLayout-20050920.jar;jna-4.1.0.jar;jna-platform-4.1.0.jar;json-20140107.jar;slf4j-api-1.7.5.jar;slf4j-jdk14-1.6.1.jar;websocket-api-9.3.12.v20160915.jar;websocket-client-9.3.12.v20160915.jar;websocket-common-9.3.12.v20160915.jar;jetty-io-9.3.12.v20160915.jar;jetty-util-9.3.12.v20160915.jar -Djava.util.logging.config.file=logging.properties -Dcom.openfin.demo.layout.url=http://localhost:8000/layout.html com.openfin.desktop.demo.LayoutServiceDemo
6+
java -cp openfin-desktop-java-example-7.1.1.jar;openfin-desktop-java-adapter-7.1.1-SNAPSHOT.jar;openfin-snap-dock-1.0.0.1.jar;TableLayout-20050920.jar;jna-4.1.0.jar;jna-platform-4.1.0.jar;json-20140107.jar;slf4j-api-1.7.5.jar;slf4j-jdk14-1.6.1.jar;websocket-api-9.3.12.v20160915.jar;websocket-client-9.3.12.v20160915.jar;websocket-common-9.3.12.v20160915.jar;jetty-io-9.3.12.v20160915.jar;jetty-util-9.3.12.v20160915.jar -Dcom.openfin.demo.layout.url=http://localhost:8008/layout.html -Dcom.openfin.demo.layout.rvm=C:\Users\username\AppData\Local\OpenFin\OpenFinRVM.exe com.openfin.desktop.demo.LayoutServiceDemo
159 Bytes
Binary file not shown.
258 Bytes
Binary file not shown.

src/main/java/com/openfin/desktop/demo/LayoutServiceDemo.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.awt.event.WindowAdapter;
99
import java.awt.event.WindowEvent;
1010
import java.io.IOException;
11+
import java.lang.System;
1112
import java.util.*;
1213
import java.util.concurrent.CountDownLatch;
1314

@@ -18,20 +19,10 @@
1819
import javax.swing.JPanel;
1920
import javax.swing.SwingUtilities;
2021

22+
import com.openfin.desktop.*;
2123
import org.json.JSONArray;
2224
import org.json.JSONObject;
2325

24-
import com.openfin.desktop.Ack;
25-
import com.openfin.desktop.AckListener;
26-
import com.openfin.desktop.Application;
27-
import com.openfin.desktop.ApplicationOptions;
28-
import com.openfin.desktop.AsyncCallback;
29-
import com.openfin.desktop.DesktopConnection;
30-
import com.openfin.desktop.DesktopException;
31-
import com.openfin.desktop.DesktopIOException;
32-
import com.openfin.desktop.DesktopStateListener;
33-
import com.openfin.desktop.RuntimeConfiguration;
34-
import com.openfin.desktop.WindowOptions;
3526
import com.openfin.desktop.channel.ChannelClient;
3627
import com.openfin.desktop.win32.ExternalWindowObserver;
3728

@@ -82,7 +73,10 @@ public void windowClosing(WindowEvent we) {
8273
frame.cleanup();
8374
});
8475
application.close();
85-
Thread.sleep(2000);
76+
Thread.sleep(1000);
77+
OpenFinRuntime runtime = new OpenFinRuntime(desktopConnection);
78+
runtime.exit();
79+
Thread.sleep(1000);
8680
java.lang.System.exit(0);
8781
}
8882
catch (Exception de) {
@@ -131,6 +125,10 @@ public void actionPerformed(ActionEvent e) {
131125

132126
void launchOpenfin() throws DesktopException, DesktopIOException, IOException, InterruptedException {
133127
RuntimeConfiguration config = new RuntimeConfiguration();
128+
String rvm = System.getProperty("com.openfin.demo.layout.rvm");
129+
if (rvm != null) {
130+
config.setLaunchRVMPath(rvm);
131+
}
134132
config.setRuntimeVersion("stable");
135133
config.setAdditionalRuntimeArguments("--v=1 --remote-debugging-port=9090 ");
136134
serviceConfig = new JSONArray();
@@ -185,7 +183,7 @@ public void onError(Ack ack) {
185183
}
186184

187185
void createJavaWindow() throws DesktopException {
188-
String windowName = UUID.randomUUID().toString();
186+
String windowName = "Java-" + UUID.randomUUID().toString();
189187
LayoutFrame frame = new LayoutFrame(this.desktopConnection, appUuid, windowName);
190188
this.childFrames.put(windowName, frame);
191189
frame.addWindowListener(this.childFrameCleanListener);

0 commit comments

Comments
 (0)