GetresourceASSTREAM in Java Return to NULL problem processing

tags: java  Development language  intellij idea

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 GetResourceASSTREAM will report an empty pointer abnormality when continuing to use:

java.lang.NullPointerException: inStream parameter is null

Problem solution:



Here we will find that the resource of our resource is not a source, so our method cannot be accessed. So return NULL pointers!
Here we set the Resource to the source, so that you only need to put the resources used in the resource to access it.


After the setting is completed, re -run the program, and the Null pointer is solved abnormally! Intersection

Intelligent Recommendation

Problem: $find('') return null

the problem is : $find('<%=RadWindow1.ClientID %>') always return null. i spent much time found out where is the problem.   if you added follow code to the RadAjaxManager , you will met the...

SocketClient.class.getClassLoader().getResourceAsStream path problem

The methods getResourceAsStream("") and getResource("") are often used to get the configuration file specified in the compilation path. The usage is similar. The following uses get...

getResourceAsStream () path problem

Take the example tomcat comes to do the project examples: From the tested code can be seen 1. session.getServletContext().getResourceAsStream("/");  Equivalent to the current project di...

Usage of getResourceAsStream in Java

Record it for easy review. . . First, there are several types of getResourceAsStream in Java:  1. Class.getResourceAsStream(String path) : Path does not start with '/', the default is to take res...

I understand GetResourceAsStream in Java

I. Overview The problem of always entangling the path when reading the configuration file, in fact, all path problems always escape, do not take off several keywords Relative path, absolute path, clas...

More Recommendation

Java 8 processing character stitching has NULL problem

We must deal with character stitching during the development process. If the stitching characters are empty, NULL will appear, so what should we do. Let's use the Java8 attribute to deal with it. It c...

– Java processing null

– Start When processing a collection, if there is a null element, it will result in a null pointer exception. – See more:Java functional programming – Description: Reprint, please in...

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

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 n...

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...

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

Top