- 论坛徽章:
- 0
|
问题解决!
- package test;
- import java.io.*;
- import java.net.MalformedURLException;
- import java.net.URL;
- public class openFile {
- public void readRomateFile(String romatefilename){
- URL urlfile;
- BufferedReader in;
- PrintWriter out;
- String content = "";
- String inputLine;
- try{
- urlfile = new URL(romatefilename);
- in = new BufferedReader(new InputStreamReader(urlfile.openStream()));
- inputLine = in.readLine();
- while (inputLine != null){
- content += inputLine ;
- inputLine = in.readLine();
- }
- System.out.println(content);
- in.close();
- } catch (MalformedURLException e){
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- openFile of = new openFile();
- String romatefilename = "file:////IPADDRESS/share/test.txt";
- of.readRomateFile(romatefilename);
-
- }
- }
复制代码
不过就是在初次登陆win2003 server ,win2000 server 是要密码。怎么能解决一下呢? |
|