Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Using a classLoader to read a file in an adf application

Paul (MITsa)Mar 5 2025

JDeveloper 12.2.1.4 full stack

I'm trying to use a classloader in a bean to load a file.
The bean is in a request scope and the method used to load the file is called when a button is clicked.

When the application is deployed locally the file can be found under

o.j2ee.12.2.1.4.42.230103.1834\drs\myApp\ViewControllerWebApp.war\scripts

I've tried the following code but the file is not found

ClassLoader classLoader = myBean.class.getClassLoader();
URL myUrl = classLoader.getResource("scripts/myFile.txt");

I've tried various paths but to no avail.

What am I missing ?

Thanks

Paul

This post has been answered by Timo Hahn on Mar 5 2025
Jump to Answer

Comments

Processing

Post Details

Added on Mar 5 2025
2 comments
89 views