How to Load Files Under the War Folder in WildFly

Asked 2 years ago, Updated 2 years ago, 345 views

I am using WildFly 18.0.1 under Linux.

There is test.txt under the war folder WEB-INF/classes/.
What should I do if I press a specific button on my browser to read the contents of the test.txt file and display it on the screen?

wildfly

2022-09-30 21:55

1 Answers

Thread.currentThread().getContextClassLoader().getResourceAsStream("test.txt");

can be retrieved as the InputStream type in .


2022-09-30 21:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.