File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
page-object/src/main/java/com/iluwatar/pageobject Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -69,25 +69,21 @@ private App() {
69
69
*/
70
70
public static void main (String [] args ) {
71
71
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 ());
75
74
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 ()) {
79
77
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...
86
81
Runtime .getRuntime ().exec ("cmd.exe start " + applicationFile );
87
- } catch (IOException e ) {
88
- e .printStackTrace ();
89
82
}
90
83
84
+ } catch (IOException ex ) {
85
+ ex .printStackTrace ();
91
86
}
87
+
92
88
}
93
89
}
You can’t perform that action at this time.
0 commit comments