A: 

You need to have your locale name in your properties file name.

Rename your properties file to Messages_es.properties

Since you haven't declared any package, both your compiled class file and the properties file can be in the same root directory.

EDIT in response to comments:

Lets say you have this project structure:

test\src\foo\Main.java (foo is the package name)

test\bin\foo\Main.class

test\bin\resources\Messages_es.properties (properties file is in the folder 'resources' in your classpath)

You can run this with:

c:\test>java -classpath .\bin foo.Main

Updated source code:

package foo;
import java.util.Locale; 
import java.util.ResourceBundle;
import javax.swing.JFrame;

public class Main {

  public static void main(String[] args) {

  Locale currentLocale;
  ResourceBundle messages;

  currentLocale = new Locale("es");

  messages = ResourceBundle.getBundle("resources.Messages", currentLocale);
  System.out.println(messages.getString("Messagesgreetings"));
  System.out.println(messages.getString("Messagesinquiry"));
  System.out.println(messages.getString("Messagesfarewell"));
}
}

Here as you see, we are loading the properties file with the name "resources.Messages"

Hope this helps.

Marimuthu Madasamy
I do have the local names in the file name.I do NOT want to have both files in the same root directory, that's the whole problem here :(
Gabriel A. Zorrilla
My path is like:Test/lang/Messages_es.propertiesTest/src/test/Main.javaInstead of running java -classpath .\bin foo.Main i set it into the project settings, no luck.
Gabriel A. Zorrilla
Either copy your lang folder into the output folder of your project or if you use Eclipse copy your lang folder under src then it will be automatically compiled into your output folder and load the bundle with name lang.Messages
Marimuthu Madasamy