Java resources resolution
Questions tagged [java-resources]
18 questions
1
vote
0 answers
Could not resolve legacy-support-core-utils-1.0.0.jar (androidx.legacy:legacy-support-core-utils:1.0.0)
i get this error when i want to build android studio project
mergeDebugJavaResource
Could not resolve legacy-support-core-utils-1.0.0.jar (androidx.legacy:legacy-support-core-utils:1.0.0)
my gradle :
// Top-level build file where you can add…

Abbas Azadeh
- 21
- 2
1
vote
0 answers
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
File f = new…

abhishek narayan
- 109
- 1
- 1
- 10
1
vote
1 answer
Why I can't retrieve this file when I run the .jar version of my Spring Boot application?
I am working on a Spring Batch application and I am finding some problem retrieving an SSL certificate file (used from RestTemplate) when I execute the .jar file containing my application. My application works fine if I run it from STS (Eclipse).
I…

AndreaNobili
- 40,955
- 107
- 324
- 596
1
vote
0 answers
Writing and reading Resource files using Jackson
I'm trying to save a HashMap as a JSON file using Jackson.
I want said file to be located in my resources folder.
try {
new ObjectMapper().writeValue(
new File(MyClass.class.getResource("/path/file.json").toURI()),…

moeux
- 191
- 15
1
vote
1 answer
Reading.sql file from custom location other than resouces folder using @sql spring boot test
Hi I have written test case using spring data jpa test . Test case are running fine when i put data.sql and schema.sql file inside test/resources folder even though without using @Sql annotation because of default behaviour of spring boot test.
But…

henrycharles
- 1,019
- 6
- 28
- 66
0
votes
0 answers
Getting Response too large exception when executing rest api POST using RestTemplate SpringBoot
I am getting Response too large when executing exchange (type POST) method from Spring Boot restTemplate.
Below is the output
{"errors":[{"message":"Response too…

Dev
- 11
- 3
0
votes
1 answer
Sprint MVC tries to get resources with session id
When I load my Spring MVC site, spring:url appends jsessionid to the resource sources and they will not be found.
This only happens the first time opening it. When reloading the site, it isn't there and the page loads correctly. Also every time,…

BeeTheKay
- 319
- 2
- 15
0
votes
1 answer
Gradle does not copy package-local test resources
I'd like gradle to behave like Eclipse when it executes the tests. Here is a minimal setup:
plugins {
id 'eclipse'
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation…

zb226
- 9,586
- 6
- 49
- 79
0
votes
1 answer
Spring ResourceUtils showing strange behavior loading a test resource as a File
Java 11 and Spring Boot here. I have the following project directory structure:
myapp/
application.yml
app/
src/
main/
java/
resources/
test/
java/
resources/
smoke/
…

hotmeatballsoup
- 385
- 6
- 58
- 136
0
votes
1 answer
How to cache ResponseEntity in spring boot
I am trying to cache ResponseEntity in spring boot but unable to find a proper way to implement the same.
There are few examples where
return ResponseEntity.ok()
.cacheControl(CacheControl.maxAge(20, TimeUnit.SECONDS))
…

Indra Neel
- 125
- 2
- 7
0
votes
2 answers
Can't enumerate `class` files with ClassLoader#getResources()
I am trying to enumerate classes in the package with
Enumeration resourceUrls = myObject.getClassLoader().getResources("path/to/my/package/");
while (resourceUrls.hasMoreElements()) {
...
Unfortunately it returns nothing. Why?
Assuming path…

Dims
- 47,675
- 117
- 331
- 600
0
votes
1 answer
JAVA ClassLoader.class and any other explicite class calling of "getResource(...)" work differently?
note: this is a named-module java project
Why does getting a resources in java work like this?
I got two packages, in main func both are printing the URL of "/respath/tmp.txt" in a jar-file syntax with corresponding to its classes.
How does this…

Liveon Phoenix
- 43
- 9
0
votes
1 answer
Where do I put my resource file to make it readable in Spring using classpath?
I'm trying to load a text file with Java, Maven & Spring, following the examples at
https://www.baeldung.com/spring-classpath-file-access#3-using-resourceloader
Also using this guide as the base for my application and…

user985366
- 1,635
- 3
- 18
- 39
0
votes
3 answers
Java : getClass().getResource().toURI() Vs getClass().getResourceAsStream()
I have a java multiple modules sbt project and some of them contains a resources folder.
module-1
resources
template.xls
module-2
resources
other.xls
After packaging I got :
lib/module-1.jar
lib/module-2.jar
And I run my program like…

bubbles
- 2,597
- 1
- 15
- 40
-1
votes
1 answer
Error inserting image icon in java - IllegalArgumentException
I'm developing a java project for a university exam. The project involves the creation of an application with the JDBC methodology. The project is almost finished, I was dedicating myself to the aesthetic part and here the problems begin :( .
I'm…

Castrese Basile
- 19
- 3