Javet icon indicating copy to clipboard operation
Javet copied to clipboard

关于和java对象交互

Open hanChao-IsBigPenisBoy opened this issue 1 year ago • 6 comments

我发现在给出的文档中有一个对象JavetReflectionObjectFactory是在包里面不存在的,我的版本已经更新到文档的指定版本,但是还没有这个包,可以指导一下这个包在哪吗

hanChao-IsBigPenisBoy avatar Jul 01 '24 08:07 hanChao-IsBigPenisBoy

Clone this project and it's in the source code.

caoccao avatar Jul 01 '24 08:07 caoccao

抱歉我还想问一个愚蠢的问题,比如我在js代码中写一个while(true),我发现java代码就在这块阻塞了,没办法执行下面关闭的代码,如果我想手动停止这段js代码,应该怎么操作, 我写了一个子线程用来跑关闭的代码,结果不太行,并没有达到预期的效果,可以知道一下吗,下面这是我代码 1719914920021

hanChao-IsBigPenisBoy avatar Jul 02 '24 10:07 hanChao-IsBigPenisBoy

Please review the doc.

caoccao avatar Jul 02 '24 10:07 caoccao

您不会说的是v8Runtime.terminateExecution(); 主动抛出异常来终止吧

hanChao-IsBigPenisBoy avatar Jul 02 '24 13:07 hanChao-IsBigPenisBoy

如果是通过v8Runtime.terminateExecution(); 关闭掉这个进程,可以手动在打开吗,我看通过iJavetEngine.getGuard(10000)自动关闭的可以再打开,手动的这个可以吗

hanChao-IsBigPenisBoy avatar Jul 02 '24 14:07 hanChao-IsBigPenisBoy

抱歉我还想问一个愚蠢的问题,比如我在js代码中写一个while(true),我发现java代码就在这块阻塞了,没办法执行下面关闭的代码,如果我想手动停止这段js代码,应该怎么操作, 我写了一个子线程用来跑关闭的代码,结果不太行,并没有达到预期的效果,可以知道一下吗,下面这是我代码 1719914920021

If you write a Java thread in JS, then the thread will indeed run, but you must know that the main thread of the event loop is still running, so the main thread will not exit, then the asynchronous operation is also micro-queuing, which will not enter the run, and also cause blocking

Vectorted avatar Jul 30 '24 14:07 Vectorted