The launcher.properties should not be under a folder called Login. It should be placed directly in the src/main/resources/com/abc/xyz folder.


It is really as simple as I said but if the resources folder is not marked as a sources folder then this may be the problem.

This is the initial class and setup:

Now create the resources folder:

This newly created folder should be automatically marked as a sources folder and if it is blue color marked then it is. Otherwise you'll have to mark it manually:

Now you'll be able to add packages to it:

And now you can add the file to it:

And rerunning the application will not give you any null value back:

And the package view will surely show the launchers.properties file as well:

Answer from maba on Stack Overflow
🌐
JetBrains
jetbrains.com › help › idea › content-roots.html
Content roots | IntelliJ IDEA Documentation
April 17, 2026 - The IDE considers that files in this folder are generated automatically rather than written manually, and can be regenerated. ... (Java only) Resource files used in your application: images, configuration XML and properties files, and so on. During the build process, resource files are copied to the output folder as is by default.
Top answer
1 of 7
76

The launcher.properties should not be under a folder called Login. It should be placed directly in the src/main/resources/com/abc/xyz folder.


It is really as simple as I said but if the resources folder is not marked as a sources folder then this may be the problem.

This is the initial class and setup:

Now create the resources folder:

This newly created folder should be automatically marked as a sources folder and if it is blue color marked then it is. Otherwise you'll have to mark it manually:

Now you'll be able to add packages to it:

And now you can add the file to it:

And rerunning the application will not give you any null value back:

And the package view will surely show the launchers.properties file as well:

2 of 7
4

As @maba pointed out, your properties file should be in the same package as your class for your code to work.

So, you should have two files:

  • src/main/java/com/abc/xyz/Login.java
  • src/main/resources/com/abc/xyz/launcher.properties

If IntelliJ is showing the resource or not is beside the question. What you need to do is check if the results are included in your target artefact.

Do a build all in IntelliJ, open up the resulting WAR/JAR/EAR with your favorite ZIP viewer and browse into the "com/abc/xyz" folder. You should see both files there.

  • If they are, you are doing something wrong in your code. Check for typos, especially dots and spaces at the end or beginning (e.g. "launcher.properties[space]"), copy/paste the file name to make sure
  • If they are not there, your IntelliJ setup is wrong. Resources do not get included in your target build. Check online for tutorials how to do this with IntelliJ idea.
Discussions

How to set resources folder in Intellij ide - java - Stack Overflow
I have an issue that I am trying to solve a while. I have a project that I imported using intelilj ide. I want to use a file that exists in my resources folder. The problem is that Intellij set the More on stackoverflow.com
🌐 stackoverflow.com
Mark src/main/resources directories and src/test/resources at 'resource Folder' and 'test resource folder' in IntelliJ
Continuing the discussion from The idea plugin breaks the new Intellij 13 .iml configuration: This does not work for me. Does it need to be whenMerged? I am using gradle 2.11 and intelliJ 14.1. Any pointers? More on discuss.gradle.org
🌐 discuss.gradle.org
8
0
December 21, 2015
intellij idea - How to mark package as a resource folder? - Stack Overflow
If you wonder why you should use the following folder structure - this is standard maven way of keeping things clean and tidy. ... Sign up to request clarification or add additional context in comments. ... This "project settings" menu described by @Funktik is in the "Project Structure Menu" under the File menu (at least in IntelliJ ... More on stackoverflow.com
🌐 stackoverflow.com
March 17, 2016
java - Adding a resource folder in intellij - Stack Overflow
I want to add a folder as a resource folder in an IntelliJ IDEA project (Java). In project settings - Modules - ProjectName_main, I put a folder as a resource folder. However I can't reach a file... More on stackoverflow.com
🌐 stackoverflow.com
January 30, 2018
🌐
JetBrains
jetbrains.com › help › idea › resource-files.html
Resource files | IntelliJ IDEA Documentation
For more information about these methods, refer to Location-Independent Access to Resources. When building an application, IntelliJ IDEA copies all resources into the output directory, preserving the directory structure of the resources relative to the source path.
🌐
Bloomu
javabook.bloomu.edu › addresources.html
How to Add Resources to an IntelliJ Project
How to Add Resources to an IntelliJ Project · Your application can load resources such as audio and image files at runtime. For this you will need to create a resources folder in the project's root directory. Your resources can be stored directly in this folder or organized within subfolders.
🌐
YouTube
youtube.com › watch
How to create a Resource folder in Java with IntelliJ and how to access it - YouTube
I will be showcasing how to create a resource folder in Intellij, and I will create a method that readers a file form the resource folder and print the input...
Published   March 5, 2021
🌐
Stack Overflow
stackoverflow.com › questions › 66108182 › how-to-set-resources-folder-in-intellij-ide-java
How to set resources folder in Intellij ide - java - Stack Overflow
Show activity on this post. In project frame, right click directory -> mark as -> Resources. Or click the Resources button in the header in your first screen shot (with that directory selected as shown).
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 4408088791186-What-is-the-path-to-files-in-root-resources-folder
What is the path to files in root resources folder – IDEs Support (IntelliJ Platform) | JetBrains
October 12, 2021 - I have a folder at the same level as "src" called "res", which I have marked as my resources root. In it, I have folders "data" and "graphics". The data folder contains a single file, "data.xlsx", ...
Find elsewhere
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360000655999-Creating-or-jumping-to-a-resource-folder-for-a-given-class
Creating or jumping to a resource folder for a given class – IDEs Support (IntelliJ Platform) | JetBrains
If that folder doesn't exist yet I copy the relative path of the java file, remove everything before "src", navigate to the resources folder, create a new folder and paste the path.
🌐
Gradle
discuss.gradle.org › help/discuss
Mark src/main/resources directories and src/test/resources at 'resource Folder' and 'test resource folder' in IntelliJ - Help/Discuss - Gradle Forums
December 21, 2015 - Continuing the discussion from The idea plugin breaks the new Intellij 13 .iml configuration: This does not work for me. Does it need to be whenMerged? I am using gradle 2.11 and intelliJ 14.1. Any pointers?
Top answer
1 of 3
22

This can be solved in several ways. An example of a good approach would be the following folder structure:

src
  main
     java
     resources
  test
     java
     resources

When this is done, you put all you java classes under src/main/java/com.mycompany package and any resources under /src/main/resources/com/mycompany folder.

To link them together, go to the project properties, and find the Path tab. Mark the src/main/java and src/main/resources as source folders. (see the screen-shot attached)

If you link them together, you'll be able to use getResourceAsStream() method. If you wonder why you should use the following folder structure - this is standard maven way of keeping things clean and tidy.

2 of 3
3

Directories Creation

Intellij creates directories when you ask her to create package. It is not an error.

If you create package "com", it will create the dir "com", and if you create a source file there, it will think that the file is in the package "com".

If you create package "com.next.pack", it will create three nested dirs "com", then "next", then "pack", and if you create a source file there, it will think that the file is in the package "com.next.pack".

Directories Structures

Only the path under the source root is taken as a package. Any directory(ies) can be set as a source root(s).


Resources roots

Make practically any structure of directories. Somewhere in it there is the root dir of resources. Right-click it and Mark Directory As ... Resources Root.

Notice, the same method can be used for the directories structures for tests, test classes, and test resources. Look here.

🌐
Xy2401
jetbrains.com.xy2401.com › help › idea › creating-resources.html
Creating Resources - Help | IntelliJ IDEA
November 29, 2019 - You can create separate resource definition files and entire folders. ... IntelliJ IDEA composes the name for the new resource folder from the resource type and the qualifiers you choose, and creates a folder with this name under the res folder.
🌐
Stack Overflow
stackoverflow.com › questions › 48518762 › adding-a-resource-folder-in-intellij
java - Adding a resource folder in intellij - Stack Overflow
January 30, 2018 - However I can't reach a file in the folder. General paths are like below. LocalProject | - src | - main | - java | - resources
🌐
Reddit
reddit.com › r/intellijidea › intellij idea ce can't recognize resources folder when using gradle extension
r/IntelliJIDEA on Reddit: IntelliJ IDEA CE can't recognize resources folder when using Gradle extension
December 7, 2019 -

So, I am trying to load a BufferedImage. I know how to do this and I got the exact same code and images to work in a different IntelliJ project file without using Gradle. The issue is that I am getting this exception because it does not recognize my resources folder for whatever reason. My resources folder is marked as "Resources Root" as it should be both projects.

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null!

I've been doing some searches online and it appears to be a common problem with the Gradle extension on IntelliJ but I'm struggling to comprehend the solution. I'm wondering if I can fix it just by toggling a setting so that my resources are included in the class path?

I would honestly just not use Gradle (in this situation, not knocking the program as a whole), but this is a school project where I am required to.

🌐
JetBrains
jetbrains.com › help › idea › web-application-static-content.html
Configure static content resources | IntelliJ IDEA Documentation
June 17, 2024 - Store the required resources and directories below the <project root>\web folder.
🌐
Coderanch
coderanch.com › t › 770883 › frameworks › Trouble-creating-viewing-files-resources
Trouble for creating/viewing files from the resources folder (intellij) (Spring forum at Coderanch)
March 7, 2023 - Hello, i would like your insights on a problem i have. I have a resources folder and i would like to create a new file in. My data base have at the "Article" table : path and filename. The path is « /img/articles/thumbnail/ » which is in the "resources" folder on intellij.
🌐
itversity
discuss.itversity.com › t › unable-to-find-resources-folder-in-intellij-project-struture › 3800
Unable to find "Resources" folder in IntelliJ project struture - itversity
April 2, 2017 - Unable to find "Resources" folder in IntelliJ project structure. am trying to add "applications.properties" file in "Resources" folder for TypeConfig Lib . I see "Resources folder" option in File->Project Struture. I t…
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 8730320830994-Intellij-Resource-files-not-found
Intellij Resource files not found – IDEs Support (IntelliJ Platform) | JetBrains
November 23, 2022 - In the background, Intellij puts classes into build/classes and resources to build/resources folder. But when executing my application, the classpath only consists of the build/classes directory and is missing the build/resources part.