Linked Questions
11 questions linked to/from Classpath resource within jar
6 votes
4 answers
14k views
Java relative file paths
I've got a Java question that I've been having a trouble with: what is a good way to indicate relative file paths. Let me be more specific. I want to be able to say to always look for configuration ...
6 votes
2 answers
21k views
Including Images with an executable jar
I have been browsing Stackoverflow all day looking for how to do this and I have not been successful yet I am packaging a quick game I made into a executable jar but I didnt reference the images ...
2 votes
5 answers
10k views
Java: Loading resources from the file system
My Project Setup I have the following project setup: \program.jar \images\logo.png In my code, I reference the image with the relative URL "images/logo.png". Problem If I run this program ...
9 votes
3 answers
1k views
Adding images to a Java project in Android Studio?
I'm trying to add my java project in android studio. I got many references & added my Project in Android studio. Now i am unable to add the assets to my projects. So please help me to solve it ...
0 votes
2 answers
2k views
Access files within resource directory in maven generated jar
I've done my research, but I just really can't get it to work. I'm using Spring Boot with Maven. Thymeleaf and jquery for my frontend. My directory: project-system/ ├── mvnw ├── mvnw.cmd ├── pom.xml ...
0 votes
1 answer
2k views
Calling shell script from Java by giving a relative path of script location
I am working on a project wherein I have to call my shell script stored at the location where my java files reside.I am currently calling the shell script by giving a hard-coded (absolute) path.I want ...
0 votes
1 answer
617 views
How does jersey create static members in one resource
I am creating a simple REST service, which owns only REST resource (java class with Jersey annotations). This REST resource needs several Java objects to work. These Java objects are very big, a few ...
1 vote
1 answer
329 views
using R in JAR file?
I am working with a library as a JAR where i have added strings and sending the context of main Application to fetch string to register GCM. This is my method in the JAR file:- void registerGCM(...
0 votes
0 answers
173 views
File not found exception while reading the from jar in spring?
I am working on spring ,I want to read file name from a jar file,But I am getting FileNotFoundException. Any one help me, please check my code below. ClassPathResource classPathResource = new ...
0 votes
3 answers
90 views
Java program that worked in Eclipse fails when in a Jar
The following line of code: SoyFileSet sfs = sfsBuilder.add(this.getClass().getResource("templates/mail.soy")).build(); works when run outside of a Jar but fails with a null pointer exception. ...
1 vote
0 answers
49 views
Not able to locate the file in a Java project which is imported in another Java project as a library
My automation script is failing in a Java project, as it has another java project as a library imported, in which I am reading a file named 'browserstack.parallel.conf.json' in the 'res' folder using ...