Re: Properties file in java
Hey,
Even I was trying the same kind of a problem. If you have any solution for this then please do post back. Actually , I am trying this, for now I have with me is this, that is to do the things I use the following.
Code:
System.out.System.out.println("something");
and I would like to:
Code:
System.out.System.out.println(Text1);
do you have any idea how to achieve this, if you know then please post I am the interested here.
Re: Properties file in java
Hello,
I have modified your code, you can try the following code. Here it is, see if this helps you
Code:
Public static void hand(String args[]) throws Exception {
String lang = new String(args[0]);
String con = new String(args[1]);
Local cur = new Local(lang, con);
ResourceBundle msg = ResourceBundle.getBundle("MessageBundle", CurrentLocale);
String message = msg.getString("Text1");
FenetreAplic f = new FenetreAplic();
}
Re: Properties file in java
Hello,
Well ok but how I use
Code:
String message = messages.getString("Text1");
in other classes that do not know the class that contains the hand? I understand this, i guess. if not args [0] and args [1], I use Jcreator So how do I add values in it? and he puts what he defaults? If you have other alternative method for this then please do post back. I am interested in this topic.
Re: Properties file in java
Hello,
You have two options:
- Or pass the values retrieved from your ResourceBundle class to class,
- Within each class that needs access, repeat the code, or write a class that returns the desired message.
Otherwise default args [0] and args [1] does not contain anything that is even worse in the args array is not initialized, therefore null. But args [0] does not exist, then args [0] causes an error type IndexOutOfBoundException. As for JCreator I do not know so I can not help you, but I'm sure that looking a bit you'll find, because most of the time is fairly intuitive and straightforward.
Re: Properties file in java
Hello,
Ok thank you, I'm going to create another class to handle it, it will be easier than passing the value from class to class. Good for the rest I'm going because I actually see this exception. For doing the same thing, that is for the same working of the code, if you have any other alternative , then please let me know, it would be great for me. Thanks you in advance.