简体   繁体   中英

Read File in GWT server side

I need to read a properties file in the server-side of a GWT application.

I've tried to put the file in the root of the application and into the src folder. However, in both tries, A FileNotFound exception is thrown.

I create the file using the following code:

File file = new File("errors.properties");

Is it wrong? Where should I put the file?

into your war folder. I suppose you use Eclipse and integrated Google plugin to generate the app and also to run it.

You have to read the properties in your server side code and then send it to your GWT code. See this page for server-client communication. The file itself should probably be in your war folder. Also you cannot use File in your GWT code as it is not a supported emulated JRE library class. See here for supported library classes available in GWT.

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