import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; public class mulOpenUrl { public static void main(String[] args) { try { String encoding = "unicode"; // CharacterSet File file = new File("D:\\list.txt");//File Path if (file.isFile() && file.exists()) { InputStreamReader read = new InputStreamReader(new FileInputStream(file),encoding); BufferedReader bufferedReader = new BufferedReader(read); String oneLine = null; while ((oneLine = bufferedReader.readLine()) != null) { //use system browser open the url String url = "explorer http://"+oneLine.toString().trim(); Process process = Runtime.getRuntime().exec(url); } read.close(); } } catch (Exception e) { e.printStackTrace(); } } }
本文出自 “p6xos” 博客,请务必保留此出处http://p6xos.blog.51cto.com/6221518/1654210
原文地址:http://p6xos.blog.51cto.com/6221518/1654210