2010-09-21 40 views
0

我想.pdf文件鏈接到一個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) 

任何一個可以幫助我,

預先感謝。

+0

please使用代碼(101)按鈕編寫代碼。 java是否理解「gopher://」協議? – Jayan 2010-09-21 08:37:59

回答

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

郵報滿snippet if if possible ....