Java : The constructor JSONTokener(InputStreamReader) is undefined

南笙酒味 提交于 2019-12-08 09:37:03

问题


I have a quite strange issue with Java, I'm getting an error on some machines only, I would like to know if there is any way I can avoid that:

This is the line of code concerned:

JSONTokener jsonTokener = new JSONTokener(
                new InputStreamReader(is, "UTF-8"));

This is the error I get on some machines

The file *.java could not be compiled. Error raised is : The constructor JSONTokener(InputStreamReader) is undefined

回答1:


Check the classpath on the machines where this error occurs. This could happen because the library that contains the JSONTokener class is from an older version, where only the JSONTokener(String) is available, and not JSONTokener(Reader).



来源:https://stackoverflow.com/questions/3725541/java-the-constructor-jsontokenerinputstreamreader-is-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!