我有个文本文件Demo.txt放在D盘下面 D:\Demo.txt写以个URL
来源:百度知道 编辑:UC知道 时间:2024/06/17 05:38:19
我有个文本文件Demo.txt放在D盘下面 D:\Demo.txt
用setPage()方法条用它里面要写一个URL
问怎么写这个URL
如果能帮我顺便解释下这个追20分
String filepath = "file:"+System.getProperty("user.dir") +
System.getProperty("file.separator") +xxx;
"file:"//
System.getProperty("user.dir")//
。。。是的哈
我一直在问人这个呢
用setPage()方法条用它里面要写一个URL
问怎么写这个URL
如果能帮我顺便解释下这个追20分
String filepath = "file:"+System.getProperty("user.dir") +
System.getProperty("file.separator") +xxx;
"file:"//
System.getProperty("user.dir")//
。。。是的哈
我一直在问人这个呢
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JEditorPane;
public class Test {
public static void main(String args[]) {
try {
URL fileUrl = new java.io.File("D:\\Demo.txt").toURI().toURL();
new JEditorPane().setPage(fileUrl);
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
&n