Record that the content of the json file obtained with getResourceAsStream is null

tags: Wrong notes  java

The code is not standardized, work two lines of tears!

Yesterday I wanted to use getResourceAsStream to get the content of the json file in the resources, and found that it was always null
Finally, I changed the uppercase of the first letter of the file name to lowercase to get

I don’t know if it’s an irregular problem.

Intelligent Recommendation

Hadoop HDFS randomly obtained file content

introduction: Need to get a directory from HDFS: Total 3000 parts in the directory, randomly select file part and get some data from each part as raw data. path For the folder address,totalFor random ...

Xiaobai's article --- Store the obtained collection to a JSON file

Use generics to make a tool and add it as a static method. When using it, you can call the method directly by the class name and pass in the required parameters When using it, you can pass in paramete...

The backend provides file download, when the file path is obtained, ServletContext.getRealPath is null

First, explain the background. On the SSM framework, you need to make a document download tool; The easiest way is definitely that the server obtains the file path by request, then reads it, and then ...

Solve the null problem with getResourceAsStream in IntelliJ IDEA

To solve this problem is very simple: windows version press the shortcut key alt + shift + ctrl + s mac:command + ; Enter the module configuration, select the module you are using, click sources, crea...

More Recommendation

GetresourceASSTREAM in Java Return to NULL problem processing

GetresourceASSTREAM in Java Return to NULL problem processing: The main reason for this problem is the setting of the source: ​ In our commonly used IDEA, the input stream returned with GetResourceASS...

getResourceAsStream gets the time null pointer exception

background: I have written a springboot+testng project. The project needs to be run through the mvn test command, but the getResourceAsStream method has been reporting errors and cannot run At that ti...

ClassLoader.getSystemClassLoader().getResourceAsStream("jdbc.properties"); Times null pointer exception

When connecting to the database, I reported this 500, thinking that there was a problem with the server deployment, and then the java code soon created a new Test test connection database. I found tha...

getResource and getResourceAsStream file path analysis

I. Introduction In the JDK, we provide the following methods to obtain resources under the classpath:       Which ResourceUtils.class.getResource (name), ResourceUtils.class.g...

getResourceAsStream

directory structure src:reflect/ReflectTest2.java reflect/resource/config.properties The class's getResourceAsStream is relative to the class loader directory path of the current class. The current pa...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top