0

I use Intellij Idea.

Java-classes use .txt files which are placed in folder where .java files are situated. I created .jar file with maven and pom.xml. But there are no .txt in .jar file. How to add them there?

UPDATED:

I have such structure src/main/java/Project-name/ for .java files. And src/main/resources/for .txt files. Within .java files I access files as ../../resources/filename.xml and all works fine. But .jar-files created with maven says:

Unable to open "../../resources/filename.xml" 

How correctly should I declare filenames?

Kenenbek Arzymatov
  • 8,439
  • 19
  • 58
  • 109

1 Answers1

1

You are going against the convention. Java source goes to src/main/java but your resources must go to src/main/resources. The rest ist handled by Maven.

Michael-O
  • 18,123
  • 6
  • 55
  • 121