JSONObject doesn’t created in executable jar

I try use JSON in my app. In IDEA it’s ok and works well but if I create jar file then line:

new JSONObject(line)

doesn’t create JSONObject. I’m sure cuz if use sout in jar for lil debug after this line I have nothing.

In my old version I used
org.json 20180813 and it was working but for now I don’t know why not.

Someone can give some solutions or advise? The program on this line simply stops and does nothing, but does not close with any error.

private void getItems() {
        long searchingTimeOut = Clock.systemDefaultZone().millis() + 8000;
        if (Files.exists(MyJsonObj)) {
            while (true) {
                try {
                    byte[] byteLine = Files.readAllBytes(MyJsonObj);
                    String line = new String(byteLine, StandardCharsets.UTF_8);
                    if (line.endsWith("}}")) {
                        setItems(new JSONObject(line));
                        break;
                    }
                    if (searchingTimeOut < Clock.systemDefaultZone().millis()) {
                        setEmptyJson();
                        break;
                    }
                } catch (IOException e) {
                    setEmptyJson();
                    delFiles();
                    break;
                }
            }
        } else {
            setEmptyJson();
        }
        delFiles();
    }

Leave a Reply

Your email address will not be published. Required fields are marked *