Hi all,
this is my first netrexx program, and it gives me an error, of course - not a good start :-) Compile goes good, but when I run "java MsgFileReader usenetfile.txt it reports " I get : in class MsgFileReader : void main( string=argv[] ) is not defined Any hint ? TIA ---------------- file MsgFileReader.nrx --------------- Class MsgFileReader extends FileReader Properties Method MsgFileReader( filename = string ) super( filename ) Method CheckType() path = rexx ok = boolean br = bufferedreader( this ) line = br.readline say line parse line path . if path = 'Path:' then ok = 1 return ok Method Main( argv = string ) parse argv filename ur = MsgFileReader( filename ) ur.checktype() corrado agusto \\___ [hidden email] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
Ciao Corrado,
hai scritto: > Hi all, > this is my first netrexx program, and it gives me an error, of course - > not a good start :-) > > Compile goes good, but when I run "java MsgFileReader usenetfile.txt it > reports " I get : > > in class MsgFileReader : void main( string=argv[] ) is not defined > > Any hint ? [..] > Method Main( argv = string ) Yes -- the "main" method you coded is not the same "main" you wanted to code. :-) The "main" method that Java wants in order to run the class as a program is main(string[]). Try with method main(CommandLine=String[]) public static Max ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
In reply to this post by Corrado Agusto
On Sat, 18 Jul 1998 13:47:20 +0200, Massimiliano Marsiglietti wrote:
>Yes -- the "main" method you coded is not the same "main" you wanted to >code. :-) Well, I'm quite sure I'm missing something - It still doesn't work :-( I tried this ( MsgFIleReader.nrx) --------- cut here ------------ Class MsgFileReader extends FileReader Properties Method MsgFileReader( filename = string ) super( filename ) Method CheckType() path = rexx ok = boolean br = bufferedreader( this ) line = br.readline say line parse line path . if path = 'Path:' then ok = 1 return ok Method Main( argv = string[] ) public static filename = argv[0] ur = MsgFileReader( filename ) ur.checktype() ----------- cut here -------------- Compiling is successful, but once I load the script I get thie : "in class MsgFileReader : void main( string argv[] ) is not defined" Compiling with -keep options gives me a Java code that shows such a method : static void Main(java.lang.String argv[]) throws java.io.FileNotFoundException,java.io.IOException{ ecc. Anyway, I renamed the file and created a msgfilereader object before defining such a class, so letting netrexx do the work and It worked fine. Is this right ? Something like this : -------- rexpress.nrx -------- ur = msgfilereader( string filename ) ur.checktype .... class MsgFileReader extends fileReader signals filenotfoundexception .... corrado agusto \\___ [hidden email] corrado agusto \\___ [hidden email] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
Ciao Corrado,
hai scritto: > Well, I'm quite sure I'm missing something - It still doesn't work :-( > > I tried this ( MsgFIleReader.nrx) [..] > Method Main( argv = string[] ) public static > filename = argv[0] > > ur = MsgFileReader( filename ) > ur.checktype() > ----------- cut here -------------- > > Compiling is successful, but once I load the script I get thie : > "in class MsgFileReader : void main( string argv[] ) is not defined" > > Compiling with -keep options gives me a Java code that shows such a method > : > > static void Main(java.lang.String argv[]) throws > java.io.FileNotFoundException,java.io.IOException{ ecc. Yes, that's the problem, you need "main", not "Main". Use this: ----------- cut here -------------- method main(argv = string[]) public static filename = argv[0] do ur = MsgFileReader(filename) ur.checktype() catch FileNotFoundException -- Code that handles FileNotFoundException catch IOException -- Code that handles IOException end ----------- cut here -------------- NetRexx is very forgiving about capitalization, however Java isn't -- and it wants "main" without capital letters in order to launch a program. Note: The "catch" stuff isn't needed, but someday you would need to implement it anyway. :-) Max ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to [hidden email] with the following message in the body of the note unsubscribe ibm-netrexx <e-mail address> |
Free forum by Nabble | Edit this page |