Use ResourceBundle read properties file.

String key="key"
ResourceBundle bundle = ResourceBundle.getBundle("com.karl.com.example");
String value =  bundle.getString(key);

resource file:  example.properties store in  package com.karl.com.

原文地址:https://www.cnblogs.com/zhonghan/p/3384858.html