'Why there is still error after i import the org.apache.commons.io.IOUtils? How to resolve them and how to add the import properly?
After i import it stills remain error? Where should I download the the import? How to import?
import java.util.Scanner;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.util.Scanner;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.json.JSONException;
import org.json.JSONObject;
public class Activity {
public static void main1(String[] args) {
try {
InputStream is = ReadJsonClass.class.getResourceAsStream(myData.json );
String text = IOUtils.toString(is, "UTF-8") ;
JSONObject myJsonObject = new JSONObject(text);
System.out.println(myJsonObject);
} catch (IOException | JSONException e) {
System.out.println("Try you have never caught before");
}
}
Solution 1:[1]
myData.json must be in double quotes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | David Weber |
