Lauching swing applicaiton which has exe extention in marathon java driver

125 views Asked by At

We have java swing application which has the extension of .exe so how to configure JavaProfile() to launch with Marathon JavaDriver?

JavaProfile profile = new JavaProfile(JavaProfile.LaunchMode.EXECUTABLE_JAR);
            profile.setLaunchType(JavaProfile.LaunchType.SWING_APPLICATION);
            profile.setExecutableJar("C:\\DIR\\TO\\APP\\JavaCalc.exe");

JavaDriver calculatorSession = new JavaDriver(profile);

I tried this, but it seems not correct and also throws the exception.

Jun 09, 2022 5:04:28 PM net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor start
INFO: Executing: [C:\Users\robot\.jdks\corretto-11.0.15\bin\java.exe, -jar, C:\DIR\TO\APP\JavaCalc.exe][ {JAVA_TOOL_OPTIONS=-DkeepLog=false -Dmarathon.launch.mode=executablejar -Dmarathon.mode=playing -javaagent:"C:\Users\robot\.m2\repository\com\jaliansystems\marathon-java-agent\5.4.0.0\marathon-java-agent-5.4.0.0.jar"=57191}]
Error: Invalid or corrupt jarfile C:\DIR\TO\APP\JavaCalc.exe
Jun 09, 2022 5:04:32 PM net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor start
WARNING: The application exited before establishing the connection: [C:\Users\robot\.jdks\corretto-11.0.15\bin\java.exe, -jar, C:\DIR\TO\APP\JavaCalc.exe][ {JAVA_TOOL_OPTIONS=-DkeepLog=false -Dmarathon.launch.mode=executablejar -Dmarathon.mode=playing -javaagent:"C:\Users\robot\.m2\repository\com\jaliansystems\marathon-java-agent\5.4.0.0\marathon-java-agent-5.4.0.0.jar"=57191}]
org.openqa.selenium.WebDriverException: The application exited before establishing the connection
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'ROBOT', ip: '192.168.1.114', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_332'
Driver info: driver.version: JavaDriver
    at net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor.start(JavaDriverCommandExecutor.java:103)
    at net.sourceforge.marathon.javadriver.JavaDriverCommandExecutor.execute(JavaDriverCommandExecutor.java:129)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at net.sourceforge.marathon.javadriver.JavaDriver.<init>(JavaDriver.java:156)
    at net.sourceforge.marathon.javadriver.JavaDriver.<init>(JavaDriver.java:131)
    at net.sourceforge.marathon.javadriver.JavaDriver.<init>(JavaDriver.java:112)
    at CalculatorMarathonTest.setUp(CalculatorMarathonTest.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
    at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:176)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:122)
    at java.util.ArrayList.forEach(ArrayList.java:1259)
    at org.testng.TestRunner.privateRun(TestRunner.java:766)
    at org.testng.TestRunner.run(TestRunner.java:587)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
    at org.testng.SuiteRunner.run(SuiteRunner.java:286)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1109)
    at org.testng.TestNG.runSuites(TestNG.java:1039)
    at org.testng.TestNG.run(TestNG.java:1007)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)```
1

There are 1 answers

0
Aditya Karra On

Marathon sets JAVA_TOOL_OPTIONS for java agent and port where it is running. So you executable might be over writing the property.