Note:
1)myPropertyFile.properties file should be placed in your classpath or in src directory of your project.
2) Check sytax error in your file if any otherwise working very fine.
public class Test{
public static String MyMailId ;
static
{
try
{
ResourceBundle resourceBundle = ResourceBundle.getBundle("myPropertyFile");
MyMailId=resourceBundle.getString(" MyMailId ");
System.out.println(MyMailId);
}
}
1)myPropertyFile.properties file should be placed in your classpath or in src directory of your project.
2) Check sytax error in your file if any otherwise working very fine.
public class Test{
public static String MyMailId ;
static
{
try
{
ResourceBundle resourceBundle = ResourceBundle.getBundle("myPropertyFile");
MyMailId=resourceBundle.getString(" MyMailId ");
System.out.println(MyMailId);
}
catch (Exception e)
{
System.err.println("Error in reading property file." + e.getMessage() );
}
}
}