I am using IntelliJ IDEA 14 and I want to add file outside of src to the JAR file. This is my current project structure.
I want to add layout.txt and saveddata.txt to the JAR file executable. I've been googling on that for a while can't find the solution
In case you need to see my code. This is how I am reading file
private Path layoutPath = Paths.get("resources/layout.txt");
content = new String(Files.readAllBytes(layoutPath));
Here is my project structure
From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Project Settings | Modules. Select the necessary module and then open the Sources tab in the right-hand part of the dialog. Click Add Content Root and specify the folder that you want to add as a new content root.
To do this, open the File > Project Structure dialog, select the Modules tab, and click on the resources folder. The result will be as shown below. Your application can now access resources from the resources folder.
From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Modules | Dependencies. Alt+Insert and select a dependency type: JARs or directories: select a Java archive or a directory from files on your computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With