[英]Java (TM) Platform SE binary still running on processes
I created a console application using Java, then exported it as runnable JAR file. 我使用Java创建了一个控制台应用程序,然后将其导出为可运行的JAR文件。 but when I run the JAR file the automation is finished but the "Java (TM) Platform SE binary" is still on background, I tried to put
System.exit(0)
and still not able to terminate the process. 但是,当我运行JAR文件时,自动化已完成,但是“ Java(TM)Platform SE二进制文件”仍在后台,我试图放入
System.exit(0)
,但仍然无法终止该过程。
I'm also trying to run this automatically in Task Scheduler in indefinitely repetition every 15 minutes, the problem is it will not run again after 15 minutes since the "Java (TM) Platform SE binary" is still in process and identified its status as running. 我还尝试每15分钟无限期地在Task Scheduler中自动运行此程序,问题是由于“ Java(TM)Platform SE二进制文件”仍在处理中,并且标识为“运行。
I'm pretty sure that all my automation task is all finished without error and not creating another threads. 我很确定我所有的自动化任务都已正确完成并且没有创建其他线程。
Here is my code below: 这是我的代码如下:
public static void main(String[] args) {
String jarName = new File(Selenium.class.getProtectionDomain().getCodeSource().getLocation().getPath())
.getName();
System.out.println("Running " + jarName + " Automation");
if (args.length >= 1 && args[0].toLowerCase().equals("-run")) {
for (int i = 1; i < args.length; i++) {
String pram = args[i].replace(jarName + "_", "");
if (pram.toLowerCase().equals("all")) {
GFC.execute("Login");
GFC.execute("SwitchIntegration");
GFC.execute("BODActivate");
GFC.execute("Users");
GFC.execute("Settings");
GFC.execute("AccountingEntityRegistration");
GFC.execute("CustomizedData");
GFC.execute("BOD");
GFC.execute("BODAttributesMDM");
GFC.execute("BODAttributesTransactional");
GFC.execute("CMD");
GFC.execute("CMDAttributes");
GFC.execute("CMDDataEntry");
GFC.execute("CMDActivate");
GFC.execute("AccountingEntity");
GFC.execute("AccountingEntityMapping");
GFC.execute("JETemplates");
GFC.execute("Scenarios");
GFC.execute("Rules");
GFC.execute("RulesScript").quit();
} else {
if (!pram.equals("Login")) {
GFC.execute("Login");
}
GFC.execute(pram).quit();
}
}
if (Boolean.parseBoolean(infor.automation.utils.Properties.get("gfc.enableemailer"))) {
sendEmail();
}
}
}
Update: 3/14/2018 更新: 3/14/2018
I make a workaround or maybe a solution. 我提出了一种解决方法或一种解决方案。 I found out that the
System.exit(0)
on main will only close the console application, but the "Java (TM) Platform SE binary" will remain. 我发现main上的
System.exit(0)
将仅关闭控制台应用程序,但“ Java(TM)Platform SE二进制文件”将保留。 To terminate this I extended to JFrame
class to be able to override the ExitApp()
. 为了终止此操作,我扩展到
JFrame
类,以便能够覆盖ExitApp()
。 Inside the ExitApp()
I add window listener and in windowClosing()
I called the disposed()
and System.exit(0)
once more. 内侧
ExitApp()
我添加窗口侦听和windowClosing()
我称为disposed()
和System.exit(0)
一次。 I don't have any idea how this even works. 我不知道这怎么工作。 If someone know how this works feel free to update this answer.
如果有人知道如何工作,请随时更新此答案。
public class TestClass extends JFrame {
public void ExitApp() {
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
// Dispose Java (TM) Platform SE binary.
dispose();
// Close the Java.exe I'm not sure.
System.exit(0);
}
});
}
public static void main(String[] args) {
// Close Your Application Trigger ExitApp();
System.exit(0);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.