Coming from C# background, I'm used to creating a resource file Resources.resx
in Visual Studio. This generates a class in the background and I can access resoures by Resources.ResourceName
, which has some benefits
AFAIK, the equivalent to a RESX file in Java is a Properties file. I can access a resource using ResourceBundle.getBundle("filename").getString("resourcename");
. As you can see, the filename and the resource name are strings and
I strongly doubt that I'm the first person who wants all the additional benefits of generated code, so
How can I generate classes from properties files in Eclipse and use it like in C#?
you can use jlibs library. see tutorial Internationalization made easier. BTW I am the owner of this project;
this library provides compile time safety and uses annotations at compile time to generate java code