我想为我的应用读取一些数据。这是我的代码:
URL url = Myclass.class.getResource("/data/file.txt"); //Myclass is my class name
File file = new File(url.toString()); //maybe I met error here.
//File Constructor just receive String object, I don't know how to convert
FileInputStream reader = new FileIputStream(file);
我不知道如何将 url 更改为 File 来阅读它。请告诉我如何解决。
谢谢 :)