Java读取classpath中的文件
?
/** * 类AppsImport.java的实现描述:TODO 类实现描述 * * @author liangliang.maoll 2011-8-29 上午10:33:06 */public class AppsImport { private static final BranchService BRANCH_SERVICE = MinasServiceLocator.getBranchService(); private static final String token = TokenService.getToken(); private static final String REPO_INTL = "intl"; public static void main(String[] args) { InputStream in = ClassLoader.getSystemResourceAsStream("app_name.txt"); BufferedReader bufferReader = new BufferedReader(new InputStreamReader(in)); String tempString = null; try { tempString = bufferReader.readLine(); String[] appNames = tempString.split(","); for (int i = 0; i < appNames.length; i++) { appNames[i] = appNames[i].substring(1, appNames[i].length() - 2); } bufferReader.close(); } catch (IOException e) { e.printStackTrace(); } }}?