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
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
Ideal would be an option "Jump to resource folder" which would do the same for me: Creare the folder if needed and then navigate there. Is there such an option? https://www.jetbrains.com/help/idea/creating-resources.html seems to do something similar but I don't develop for android. ... To quickly navigate to Project tool window you can use Select in Project View action.
๐ŸŒ
Bloomu
javabook.bloomu.edu โ€บ addresources.html
How to Add Resources to an IntelliJ Project
You can see in the following image how audio and image files have been organized within a resources folder. Next, you need to mark the folder as resources root. To do this, open the File > Project Structure dialog, select the Modules tab, and click on the resources folder.
Discussions

java - Adding resources in IntelliJ for Maven project - Stack Overflow
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 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: ... Sign up to request clarification or add additional context in comments. ... Thanks @maba, it is not working. It is still giving null, and one more thing, when I change the intellij... More on stackoverflow.com
๐ŸŒ stackoverflow.com
maven - How to create 'resources' folder in Intellij? - Stack Overflow
When I try to create a new package, I right click on it and then click on the 'mark directory as' option. However, I have nothing but the 'exclude' option. Is it because I should connect my project... More on stackoverflow.com
๐ŸŒ stackoverflow.com
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
How to Automatically Create Custom Project Folders in IntelliJ IDEA?
You can use the Project Templates feature: https://www.jetbrains.com/help/idea/saving-project-as-template.html . More on reddit.com
๐ŸŒ r/IntelliJIDEA
6
4
March 26, 2025
๐ŸŒ
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
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ web-application-static-content.html
Configure static content resources | IntelliJ IDEA Documentation
June 17, 2024 - In the Web Resource Directory Path dialog that opens, specify the desired local folder and the target location relative to the application root folder. By default, IntelliJ IDEA maps the <project root>\web folder to the root folder of the application after deployment.
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ content-roots.html
Content roots | IntelliJ IDEA Documentation
April 17, 2026 - Create a content root for your project and configure a folder structure for your production code, your tests, and resource files.
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.
๐ŸŒ
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).
Find elsewhere
๐ŸŒ
Reddit
reddit.com โ€บ r/intellijidea โ€บ how to automatically create custom project folders in intellij idea?
r/IntelliJIDEA on Reddit: How to Automatically Create Custom Project Folders in IntelliJ IDEA?
March 26, 2025 -

Whenever I start a new Java project in IntelliJ, I always create new folders in the Project folder:

- res (resource folder)

- src (source folder - this is already automatically generated)

- tests (tests folder)

Is there a way to automate this? I have a feeling there is, but I had no luck Googling, asking ChatGPT or my instructor/colleagues. That is why I resorted to asking here. Anyone know?

๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 69997794 โ€บ how-do-i-create-resources-folder-in-intellij-correctly
spring - How do I create resources folder in Intellij correctly? - Stack Overflow
Hi, I'm trying to call a file named "sample-lite.json" to my main Driver class. I created a folder named "data" within the "resources" folder that was automatically created when I first started the project with Maven and put the JSON files into the "data" folder. However, I get FileNotFoundException even though Intellij...
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 360010236699-How-to-create-a-Resource-Root-folder
How to create a Resource Root folder? โ€“ IDEs Support (IntelliJ Platform) | JetBrains
According to this, Resource Root folders are: [...] are intended for resource files in your application (images, style sheets, and so on). By assigning a folder to this category, you tell PyCharm ...
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.

๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 48518762 โ€บ adding-a-resource-folder-in-intellij
java - Adding a resource folder in intellij - Stack Overflow
January 30, 2018 - Suppose I put a tmp.txt and main.txt in the folders in /tmp/resources and LocalProject/src/main/resources, respectively, and have a class Hoge, Hoge.class.getClass().getResourceAsStream("main.txt") works but doesn't work on the other file..... ... Are you running a Maven project? You need to make sure those resource files make it to your classpath.
๐ŸŒ
Crunchify
crunchify.com โ€บ technology & tools โ€บ how to add resources folder, properties at runtime into intellij classpath? adding property files to classpath
How to add Resources Folder, Properties at Runtime into IntelliJ classpath? Adding Property files to Classpath โ€ข Crunchify
May 31, 2023 - There are so many options out there in IntelliJ IDE and itโ€™s pain to find out appropriate option for individual use. Any cheat sheet with list of all options would be a great from IntelliJ team. ... Hi Raj โ€“ kindly take a look at tutorial which explains how to read config.properties resource file.
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ add-items-to-project.html
Add items to your project | IntelliJ IDEA Documentation
March 16, 2026 - In the Project tool window (Alt+1) , right-click the node in which you want to create a new directory and select New | Directory. Alternatively, select the node and click on the toolbar or press Alt+Insert.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-add-source-folders-in-IntelliJ-from-an-existing-project
How to add source folders in IntelliJ from an existing project - Quora
Answer (1 of 2): So, for adding a source folder in the new project in IntelliJ. From the main menu, select File and then click on a project structure. Then click on Modules. Then select the necessary module and click on sources. To copy the source folders from the existing project to the new pr...
๐ŸŒ
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.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 47862062 โ€บ shortcut-in-intellij-to-create-resource-folder-with-same-path-as-of-java-file-in
Shortcut in intellij to create resource folder with same path as of Java file in main or test section - Stack Overflow
December 18, 2017 - Like ctrl + shift + T create test file in same directory path in "test" ... Save this answer. ... Show activity on this post. ... For tests, there is a specific intention named Create Test (under Settings->Intentions->Java->Declaration defined ...
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 15856892325394-How-can-I-create-a-new-resource-file-from-an-IntelliJ-Idea-plugin
How can I create a new resource file from an IntelliJ Idea plugin? โ€“ IDEs Support (IntelliJ Platform) | JetBrains
December 18, 2023 - @Override public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile) throws IncorrectOperationException { // here should be located the code to create a file for IntelliJ } ... @Override public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile) throws IncorrectOperationException { for (VirtualFile virtualFile : ProjectRootManager.getInstance(project).getContentRoots()) { String path = virtualFile.getPath(); if(path.endsWith("main")) { VirtualFile resDirectory = virtualFile.findOrCreateChildData("any_requestor", "resources"); PsiDirectoryFactory.getInstance(project) .createDirectory(resDirectory) .createFile("your_file_here") .getVirtualFile().setBinaryContent("content_of_your_file".getBytes(UTF_8)); } } // your_code_HERE }