如何在Applet表列中链接.pdf文档

时间:2010-09-21 08:35:35

标签: java applet

我想将.pdf文件链接到Applet

我正在使用以下代码

try {


 //if (column == docColId) {

String doccolvalue = this.getTable().getValueAt(row,
   column).toString();

String lPathPrefix = "gopher://muceap10.muc.amadeus.net/User Step Folders/BPS_Files/Outlooksoft CPM/01 - Production Environment/01 -
   Documentation Library/01 -
   Documents/Daily_Checks/";

String lPath = (lPathPrefix + doccolvalue).replace(" ", "%20");
 URI lURI = new URI(lPath);
 //lPathPrefix = lPathPrefix.replace(" ", "%20");
  //URI lURI = new URI(lPathPrefix + doccolvalue);
   java.awt.Desktop lDesktop = java.awt.Desktop.getDesktop();
   lDesktop.open(new File(lURI));

   } catch (Exception e) {
    e.printStackTrace();
     }

但是我收到以下错误

URI scheme is not "file"
 at java.io.File.<init>(Unknown Source)
 at client.cpm.dailyT0.CBRCPMDailyT0View.table_mouseClicked(CBRCPMDailyT0View.java:371)
 at client.cpm.dailyT0.CBRCPMDailyT0View.access$1(CBRCPMDailyT0View.java:325)

任何人都可以帮助我,

先谢谢。

1 个答案:

答案 0 :(得分:0)

在没有完整代码的情况下,我尝试使用此...

import java.net.URI;

public class SimpleTableDemo {
    public static void main(String[] args) throws Exception{
        String lPathPrefix = "gopher://muceap10.muc.amadeus.net/User Step Folders/BPS_Files/Outlooksoft CPM/01 - Production Environment/01 -  Documentation Library/01 -"+
        "Documents/Daily_Checks/";

        String lPath = (lPathPrefix + "test").replace(" ", "%20");
        URI lURI = new URI(lPath);

        System.err.println(lURI);
    }
}

似乎它正在运作......

<强>输出

gopher://muceap10.muc.amadeus.net/User%20Step%20Folders/BPS_Files/Outlooksoft%20CPM/01%20-%20Production%20Environment/01%20-%20%20Documentation%20Library/01%20-Documents/Daily_Checks/test

尽可能发布完整代码段....