简体   繁体   中英

Default path used by a java class in blazeds

I'm using Blazeds with java and flex, I need one of the java classes to read from a.dat file, and since the application is to be hosted on the server i am not providing a path to the file, ie I'm using:

input = new FileReader("file.dat");

In a standard java application I'd put the file in the project folder, however since the class is being used through blaze ds, does any one have any idea where I should place this file?

Thanks

You probably should put it into your WEB-INF/ directory.

URL url = FlexContext.getServletContext().getResource("/WEB-INF/file.dat")
input = new FileReader(url.getFile());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM