我已经让 Marathon JAVA 驱动程序在 Eclipse 中工作,当我从 Eclipse 运行代码时它工作正常。但是,当我将项目导出为可运行的 JAR 文件,然后执行 JAR 文件时,出现以下错误并且应用程序未启动。
在 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61) 引起:java.lang.NullPointerException at net.sourceforge.marathon.javadriver.JavaProfile.(JavaProfile.java:205)
import java.io.IOException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import net.sourceforge.marathon.javadriver.JavaDriver;
import net.sourceforge.marathon.javadriver.JavaProfile;
import net.sourceforge.marathon.javadriver.JavaProfile.LaunchMode;
import net.sourceforge.marathon.javadriver.JavaProfile.LaunchType;
public class SwingAutomationSample {
public static JavaDriver driver;
public static JavaProfile profile;
@BeforeClass
public void setUp() throws IOException {
try {
profile = new JavaProfile(LaunchMode.EXECUTABLE_JAR);
profile.setLaunchType(LaunchType.FX_APPLICATION);
profile.setExecutableJar("C:/Users/KarthikRaja/Desktop/Projects/xxyy.jar");
profile.setWorkingDirectory("C:/Users/KarthikRaja/Desktop/Projects");
driver = new JavaDriver(profile);
}catch(Exception e) {
System.out.println("java driver error ------------ " + e.toString());
}
}
@Test
public void Form15CBFill() throws Exception {
System.out.println("Inside Test Class");
}
}```