« Opening a metafile in .NET | Main | Word AddIn WM_INITMENU event »

Using java resources in J#

If you are using common source code in java and J#, this is how you get your resources across. Assume you have the resource files:
resources.properties
resources_en.properties
resources_en_US.properties
...

  1. Download vjsresgen from the Microsoft website and build it (it comes as source, not as aa .exe).
  2. run "vjsresgen /out:jsResources.resx *.properties". You cannot put this in your pre-build event as it then puts the full directory name as your resources name!
  3. For your project, do Add, Existing Item, and add jsResources.resx
  4. In your code put "ResourceBundle resources = ResourceBundle.getBundle("resources");". Note that the parameter is "resources" and not "jsResources"!
  5. call "String str = resources.getString("dave");".

That's it - works great.

Do you find this useful? If so please check out Windward Reports.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c6cc353ef00d835228eac53ef

Listed below are links to weblogs that reference Using java resources in J#:

Comments

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment