Skip to content

Commit f182e87

Browse files
committed
fixed app launch
1 parent 85f432f commit f182e87

File tree

1 file changed

+10
-14
lines changed
  • page-object/src/main/java/com/iluwatar/pageobject

1 file changed

+10
-14
lines changed

page-object/src/main/java/com/iluwatar/pageobject/App.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,21 @@ private App() {
6969
*/
7070
public static void main(String[] args) {
7171

72-
String currentWorkingDir = System.getProperty("user.dir");
73-
File applicationFile = new File(currentWorkingDir
74-
+ "/page-object/src/main/resources/sample-ui/login.html");
72+
try {
73+
File applicationFile = new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
7574

76-
// should work for unix like OS (mac, unix etc...)
77-
if (Desktop.isDesktopSupported()) {
78-
try {
75+
// should work for unix like OS (mac, unix etc...)
76+
if (Desktop.isDesktopSupported()) {
7977
Desktop.getDesktop().open(applicationFile);
80-
} catch (IOException e) {
81-
e.printStackTrace();
82-
}
83-
} else {
84-
// java Desktop not supported - above unlikely to work for Windows so try following instead...
85-
try {
78+
79+
} else {
80+
// java Desktop not supported - above unlikely to work for Windows so try following instead...
8681
Runtime.getRuntime().exec("cmd.exe start " + applicationFile);
87-
} catch (IOException e) {
88-
e.printStackTrace();
8982
}
9083

84+
} catch (IOException ex) {
85+
ex.printStackTrace();
9186
}
87+
9288
}
9389
}

0 commit comments

Comments
 (0)