求助:java,怎样代码实现结束正在运行的程序?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了求助:java,怎样代码实现结束正在运行的程序?相关的知识,希望对你有一定的参考价值。
参考技术A System.exit(0);终止虚拟机! 参考技术B- public class TestShutDownHook public TestShutDownHook() doShutDownWork(); private void doShutDownWork() Runtime run=Runtime.getRuntime();//当前 Java 应用程序相关的运行时对象。 run.addShutdownHook(new Thread() //注册新的虚拟机来关闭钩子 @Override public void run() //程序结束时进行的操作 System.out.println("程序结束调用"); ); public static void main(String[] args) new TestShutDownHook(); for (int i = 0; i < 1000; i++) // 在这里增添您需要处理代码 System.out.println(i);
GG运行脚本出错,求助各路大神解惑!~!~
GG修改器运行一个.LOL后缀的脚本辅助,开始时候能正常运行,后来因为操作失误可能出了点问题,GG崩溃重新启动以后运行就一直报错,本人是小白,完全看不懂是啥意思,求助各路大神能解惑,有处理方法就更好了,万分感谢!
PS:1、手机有锁没能ROOT,GG运行在VirtualXposed_0.18.2环境中
2、脚本在其它手机能正常运行,排除脚本本身问题
以下是GG报错的内容:
程序已结束::
当前脚本或许仅适用于最新版GameGuardian。请更新到最新版。
脚本错误: luaj.LuaArgError: /storage/emulated/0/Download/测试2.2.LOL:-1
bad argument #1 to 'load' (string or function expected, got nil) (field 'load')
level = 1, const = 30, proto = 0, upval = 2, vars = 30, code = 38
CALL v1..v2 SET_TOP
; PC 35 CODE 0100005D OP 29 A 1 B 2 C 0 Bx 1024 sBx -130047
stack traceback:
/storage/emulated/0/Download/测试2.2.LOL: in function 'GG'
/storage/emulated/0/Download/测试2.2.LOL: in function 'caidan'
/storage/emulated/0/Download/测试2.2.LOL: in function 'zhu'
/storage/emulated/0/Download/测试2.2.LOL: in function 'Main'
/storage/emulated/0/Download/测试2.2.LOL: in function </storage/emulated/0/Download/测试2.2.LOL:2>
/storage/emulated/0/Download/测试2.2.LOL: in main chunk
[Java]: in ?
at luaj.LuaValue.argerror(LuaValue.java:1024)
at luaj.lib.BaseLib$load.invoke(BaseLib.java:265)
at luaj.LuaClosure.execute(LuaClosure.java:532)
at luaj.LuaClosure.call(LuaClosure.java:160)
at luaj.LuaClosure.execute(LuaClosure.java:533)
at luaj.LuaClosure.call(LuaClosure.java:160)
at luaj.LuaClosure.execute(LuaClosure.java:533)
at luaj.LuaClosure.call(LuaClosure.java:160)
at luaj.LuaClosure.execute(LuaClosure.java:533)
at luaj.LuaClosure.call(LuaClosure.java:160)
at luaj.LuaClosure.execute(LuaClosure.java:533)
at luaj.LuaClosure.call(LuaClosure.java:160)
at luaj.LuaClosure.execute(LuaClosure.java:533)
at luaj.LuaClosure.call(LuaClosure.java:160)
at android.ext.Script.runScript(Script.java:5736)
at android.ext.Script$ScriptThread.run(Script.java:5474)
数据已保存
以上是关于求助:java,怎样代码实现结束正在运行的程序?的主要内容,如果未能解决你的问题,请参考以下文章