对“无法找到符号”感到困惑

时间:2011-04-25 21:26:40

标签: java

Ol'新手再来一次......我收到此消息无法找到我定义的所有文件的符号。我在下面复制了与我的问题相关的源代码:

/*---------------------------------------------------------------
// * 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();

感谢关于我做错事的任何和所有帮助......

由于

Guy“如果我在汇编程序中执行此操作,我会完成”Rich ;-)

2 个答案:

答案 0 :(得分:1)

嗯,不存在任何名为FileOutputStream的方法。如果你试图创建一个FileOutputStream(cos有一个类似的类),尝试使用类似的东西:

FileOutputStream fos = new FileOutputStream(Resp_File);

等等。我看到至少发生过两次此错误。

答案 1 :(得分:1)

看起来你正试图调用一个名为FileInputStream()的方法

Perah你打算做FileInputStream fis = new FileInputStream(...)