java - GWT Project reads properties file correctly at dev mode, but couldn't find it when I deployed it -


So I have 2 GR files which have been referred to my GWT project, both of which read the properties file :

  string PROPS_FILE = "Props.properties" attribute propfile = new properties (); PropFile.load (new FileInputStream (PROPS_FILE));   

Both jar files are coded into java and jar is exported as libraries.

The attributes file are located in the war folder in Dev mode.

It works well on dev mode, but when I try it, it encounters an error

java.io.FileNotFoundException: Props.properties (such a File or directory).

Can this work be done without modifying the jar? Thank you.

The folder structure is like this:

war

WEB-INF
-Props.properties
-Props2.properties < P> After compiling the project and deploying the use of glassfish, the folder structure is like this:

(Pat eti ...) / Application / SampleGuat OPP /

  • -VB-INF
  • -PPP Properties
  • -PRP 2. Properties

    Option 1: When you run GWT in Prod Mode, war Mr. is the WEB-INF / classes to default on its Wargpth. Try putting your properties under Web-INF / Classes If your server still can not find the attribute file, use the code below:

      InputStream = this.getClass () . GetClassLoader (). GetResourceAsStream ("Props.properties"); Properties myProps = new properties (); Myprops.load (is);   

    Option 2: Exclude the location and exclude it from your project structure - e.g. You can add this properties directory to your class in your IDA (in Eclipse, you create it in the Build Path & gt; on the file system somewhere under a properties directory. Add variables) and can also be added to the classpath while running on the server - see the documentation of your server about how to add a classpath. Like adding a directory to Classpath in a tonkat, you have to do it as mentioned here

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -