2011-04-25 96 views
-1

在這裏再次'新手'...我得到這個消息找不到所有我定義的文件的符號。我的源代碼,這是有關我的問題下面複製在:完全混淆了「找不到符號」

/*--------------------------------------------------------------- 
// * LU6.2 Transceiver 
*---------------------------------------------------------------*/ 
package APPC_LU62.java ; 

import java.nio.* ; 

import java.nio.channels.* ; 

import COM.ibm.eNetwork.cpic.* ; 

import java.io.* ; 

public class LU62XnsCvr extends Object 
{ 



     // Define I/O Files 
    static File Rqst_File = new File("C:\\APPC_LU62\\LU62XC\\CA_DMV\\Rqst_File.txt") ; 
    static File Resp_File = new File("C:\\APPC_LU62\\LU62XC\\CA_DMV\\Resp_File.txt") ; 
    static File Logr_File = new File("C:\\APPC_LU62\\LU62XC\\CA_DMV\\Logr_File.txt") ; 
    static File Mesg_File = new File("C:\\APPC_LU62\\LU62XC\\CA_DMV\\Mesg_File.txt") ; 


} 



public static void main(String args[]) 
    { 
     if (args.length < 10) 
     { 
      System.out.println("LU62XCE0013: Missing or Invalid Runtime Path and/or APPC Partner Name") ; 
      System.out.println("LU62XCE0013: This Process will be Terminated") ; 
      sys_return = 13 ; 
      SysEnd(sys_return) ; 
     } 

     String Runtime_Path = args[0] ;  // pick up the runtime path for the request and response files 
     String APPC_Partner = args[1] ;  // and the APPC Partner LU Name 
     PartLULen = APPC_Partner.length() ; // get the length of the partner luname 
     if (PartLULen > 8) 
     { 
      System.out.println("LU62XCE0013: APPC Partner Name Length Greater Than 8 bytes ") ; 
      System.out.println("LU62XCE0013: This Process will be Terminated") ; 
      sys_return = 13 ; 
      SysEnd(sys_return) ; 
     } 

     ConnectFiles() ; 

     ProcessRequests() ; 

     sys_return = 0 ; 
     SysEnd(sys_return) ; 

    } // end of main routine 




public static void ConnectFiles() 
    { 
      //Connect the LU62XC Message File 
    FileOutputStream(Mesg_File) ; 
    FileChannel MesgChnl = Mesg_File.getChannel(); 
    ByteBuffer Mesg_bufr = ByteBuffer.allocate(128) ; 


     // Does RequestFile exist? then Process it... 
    if (!Rqst_File.exists()) 
     { // Request File DOES_NOT exist 
     message_data.append("LU62XCE0113: Request File = ") ; 
     message_data.append(Rqst_File) ; 
     message_data.append(" Not Found...This Process will be Terminated") ; 
     SendMesg() ; 
     sys_return = 113 ; 
     SysEnd(sys_return) ; 
     }  


      // Connect files to program via I/O channels and buffers 
    FileInputStream(Rqst_File) ; 
    FileChannel RqstChnl = Rqst_File.getChannel() ; 
    ByteBuffer Rqst_Bufr = ByteBuffer.allocate(400) ; 

    FileOutputStream(Resp_File) ; 
    FileChannel RespChnl = Resp_File.getChannel(); 
    ByteBuffer Resp_Bufr = ByteBuffer.allocate(1024) ; 

    FileOutputStream(Logr_File) ; 
    FileChannel LogrChnl = Logr_File.getChannel(); 
    ByteBuffer Logr_bufr = ByteBuffer.allocate(428) ; 

      // Initialize log header fields 
    RqstHdr = RqstFlag.getBytes() ; // convert string to byte array 
    RespHdr = RespFlag.getBytes() ; // convert string to byte array 

    } // end subroutine ConnectFiles 

我得到以下編譯器錯誤:

src\LU62XnsCvr.java:153: cannot find symbol 
symbol : method FileOutputStream(java.io.File) 
location: class APPC_LU62.java.LU62XnsCvr 
    FileOutputStream(Mesg_File) ; 
    ^
[loading java\nio\channels\FileChannel.class(java\nio\channels:FileChannel.class)] 
src\LU62XnsCvr.java:154: cannot find symbol 
symbol : method getChannel() 
location: class java.io.File 
    FileChannel MesgChnl = Mesg_File.getChannel(); 
            ^
[loading java\nio\ByteBuffer.class(java\nio:ByteBuffer.class)] 
[loading java\nio\Buffer.class(java\nio:Buffer.class)] 
[loading java\lang\CharSequence.class(java\lang:CharSequence.class)] 
src\LU62XnsCvr.java:171: cannot find symbol 
symbol : method FileInputStream(java.io.File) 
location: class APPC_LU62.java.LU62XnsCvr 
    FileInputStream(Rqst_File) ; 
    ^
src\LU62XnsCvr.java:172: cannot find symbol 
symbol : method getChannel() 
location: class java.io.File 
    FileChannel RqstChnl = Rqst_File.getChannel() ; 
            ^
src\LU62XnsCvr.java:175: cannot find symbol 
symbol : method FileOutputStream(java.io.File) 
location: class APPC_LU62.java.LU62XnsCvr 
    FileOutputStream(Resp_File) ; 
    ^
src\LU62XnsCvr.java:176: cannot find symbol 
symbol : method getChannel() 
location: class java.io.File 
    FileChannel RespChnl = Resp_File.getChannel(); 
            ^
src\LU62XnsCvr.java:179: cannot find symbol 
symbol : method FileOutputStream(java.io.File) 
location: class APPC_LU62.java.LU62XnsCvr 
    FileOutputStream(Logr_File) ; 
    ^
src\LU62XnsCvr.java:180: cannot find symbol 
symbol : method getChannel() 
location: class java.io.File 
    FileChannel LogrChnl = Logr_File.getChannel(); 

欣賞對於任何和所有幫助我做錯了什麼...

感謝

蓋伊「如果我在彙編這樣做我會做」富;-)

+0

可能重複的[不明白「找不到符號」](http://stackoverflow.com/questions/5841904/dont-understand-cannot-find-symbol) – geoffspear 2011-05-05 14:15:40

回答

1

Mmmmm不存在任何稱爲FileOutputStream的方法。如果你想創建一個FileOutputStream(COS,有一個名爲像類),嘗試使用類似:

FileOutputStream fos = new FileOutputStream(Resp_File); 

等。我發現至少有兩次這個錯誤。

+0

現在看看它的細節(感謝@Oli編輯,順便說一句),實際上有3:Rqst_File,Resp_File和Logr_File。 – 2011-04-25 21:30:51

+0

非常感謝您的洞察力....我將不得不回顧IBM使用新I/O指南中的示例.... – 2011-04-26 02:06:21

1

它看起來像你想呼叫被叫的FileInputStream()的方法

Perahps你的意思做FileInputStream fis = new FileInputStream(...)

+0

那麼我只有一個輸入文件和三個輸出文件... – 2011-04-26 02:07:23