I occasionally get random errors when I run my program

I have never seen such errors before, for example:

FATAL ERROR in native method: JDWP cannot get thread local storage, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)

If I run my program again, an error will not appear, which I will not receive. This error appeared several times today and even in this most simplified code example:

test.java

 import java.io.File; public class test { public test() { OpenFile opf = new OpenFile("test/data.txt"); OpenFile opf2 = new OpenFile(new File("test/data.txt")); OpenFolder opfo = new OpenFolder("test"); OpenFolder opfo2 = new OpenFolder(new File("test")); } public static void main(String[] args) { new test(); } } 

Openfile.java

 import java.io.File; public class OpenFile { File openFile; public OpenFile(String filePath) { openFile(new File(filePath)); } public OpenFile(File file) { openFile(file); } public void openFile(File file) { if(file.exists()) System.out.println("Exists"); else System.out.println("!Exists"); } } 

Openfolder

 import java.io.File; public class OpenFolder { public OpenFolder(String string) { } public OpenFolder(File file) { } } 

There is nothing in my program that could cause an error, as far as I can see, and I cannot repeat the error, all I know is an error at runtime.

+6
source share
1 answer

Looks like a JDWP agent error (possibly JDK-6988950 ). Unfortunately, it was only fixed in JDK 9. Try replacing jdwp.dll / libjdwp.so with one of the JDK 9 EA .

+1
source

Source: https://habr.com/ru/post/984268/


All Articles