List(byte,byte) cannot be found in class

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

List(byte,byte) cannot be found in class

kenner

Anybody got a working copy of Filelister.nrx? I found an old copy in the book _Java in a Nutshell_ by David Flanagan. It is failing with this:


-verbose5 Filelister.nrx <--- this was passed to the script
Usage: ./NetRexxC.sh [-run] [other options] filename

NetRexx portable processor, version 2.05
Copyright (c) IBM Corporation, 2005.  All rights reserved.
Program Filelister.nrx
 6 +++ class FileLister extends Frame public
   +++       ^^^^^^^^^^
   +++ Warning: Public class name changed to same case as program name 'Filelister'
  === class Filelister ===
    constructor FileLister(String,FilenameFilter)
  21 +++    dirList = List(12, 0)
     +++              ^^^^
     +++ Error: The constructor 'List(byte,byte)' cannot be found in class 'java.util.List'


Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

rickmcguire
I think you have a conflict caused by the fact the List class was
added to the java.util package when the Collection classes came in.
Try fully qualifying the class name as java.awt.List.

Rick

On Tue, Jan 25, 2011 at 9:15 AM,  <[hidden email]> wrote:

>
> Anybody got a working copy of Filelister.nrx? I found an old copy in the
> book _Java in a Nutshell_ by David Flanagan. It is failing with this:
>
>
> -verbose5 Filelister.nrx <--- this was passed to the script
> Usage: ./NetRexxC.sh [-run] [other options] filename
>
> NetRexx portable processor, version 2.05
> Copyright (c) IBM Corporation, 2005.  All rights reserved.
> Program Filelister.nrx
>  6 +++ class FileLister extends Frame public
>    +++       ^^^^^^^^^^
>    +++ Warning: Public class name changed to same case as program name
> 'Filelister'
>   === class Filelister ===
>     constructor FileLister(String,FilenameFilter)
>   21 +++    dirList = List(12, 0)
>      +++              ^^^^
>      +++ Error: The constructor 'List(byte,byte)' cannot be found in class
> 'java.util.List'
>
>
> Kenneth Klein
> Systems Specialist
> 502-868-3644
> 859-750-5179 (Cell)
> 502-868-2298 (Fax)
> [hidden email]
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

kenner

Thanks, Rick. That put me back on the path.

Now I am getting clean (except for warnings) compiles. The the invocation of the applet fails every time.

java.lang.reflect.InvocationTargetException
        at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.InstantiationException: FileLister
        at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.InstantiationException: FileLister
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        ... 9 more
Exception: java.lang.reflect.InvocationTargetException

Do I have a problem with "packageing"??

Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]



Rick McGuire <[hidden email]>
Sent by: [hidden email]

01/25/2011 09:50 AM

Please respond to
IBM Netrexx <[hidden email]>

To
IBM Netrexx <[hidden email]>
cc
Subject
Re: [Ibm-netrexx] List(byte,byte) cannot be found in class





I think you have a conflict caused by the fact the List class was
added to the java.util package when the Collection classes came in.
Try fully qualifying the class name as java.awt.List.

Rick

On Tue, Jan 25, 2011 at 9:15 AM,  <[hidden email]> wrote:
>
> Anybody got a working copy of Filelister.nrx? I found an old copy in the
> book _Java in a Nutshell_ by David Flanagan. It is failing with this:
>
>
> -verbose5 Filelister.nrx <--- this was passed to the script
> Usage: ./NetRexxC.sh [-run] [other options] filename
>
> NetRexx portable processor, version 2.05
> Copyright (c) IBM Corporation, 2005.  All rights reserved.
> Program Filelister.nrx
>  6 +++ class FileLister extends Frame public
>    +++       ^^^^^^^^^^
>    +++ Warning: Public class name changed to same case as program name
> 'Filelister'
>   === class Filelister ===
>     constructor FileLister(String,FilenameFilter)
>   21 +++    dirList = List(12, 0)
>      +++              ^^^^
>      +++ Error: The constructor 'List(byte,byte)' cannot be found in class
> 'java.util.List'
>
>
> Kenneth Klein
> Systems Specialist
> 502-868-3644
> 859-750-5179 (Cell)
> 502-868-2298 (Fax)
> [hidden email]
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: List(byte,byte) cannot be found in class

measel

RuntimeException: java.lang.InstantiationException: FileLister

 

You need an instance of FileLister.  Post your source.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Tuesday, January 25, 2011 1:21 PM
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


Thanks, Rick. That put me back on the path.

Now I am getting clean (except for warnings) compiles. The the invocation of the applet fails every time.

java.lang.reflect.InvocationTargetException
        at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.InstantiationException: FileLister
        at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.InstantiationException: FileLister
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        ... 9 more
Exception: java.lang.reflect.InvocationTargetException

Do I have a problem with "packageing"??

Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]


Rick McGuire <[hidden email]>
Sent by: [hidden email]

01/25/2011 09:50 AM

Please respond to
IBM Netrexx <[hidden email]>

To

IBM Netrexx <[hidden email]>

cc

Subject

Re: [Ibm-netrexx] List(byte,byte) cannot be found in class

 




I think you have a conflict caused by the fact the List class was
added to the java.util package when the Collection classes came in.
Try fully qualifying the class name as java.awt.List.

Rick

On Tue, Jan 25, 2011 at 9:15 AM,  <[hidden email]> wrote:
>
> Anybody got a working copy of Filelister.nrx? I found an old copy in the
> book _Java in a Nutshell_ by David Flanagan. It is failing with this:
>
>
> -verbose5 Filelister.nrx <--- this was passed to the script
> Usage: ./NetRexxC.sh [-run] [other options] filename
>
> NetRexx portable processor, version 2.05
> Copyright (c) IBM Corporation, 2005.  All rights reserved.
> Program Filelister.nrx
>  6 +++ class FileLister extends Frame public
>    +++       ^^^^^^^^^^
>    +++ Warning: Public class name changed to same case as program name
> 'Filelister'
>   === class Filelister ===
>     constructor FileLister(String,FilenameFilter)
>   21 +++    dirList = List(12, 0)
>      +++              ^^^^
>      +++ Error: The constructor 'List(byte,byte)' cannot be found in class
> 'java.util.List'
>
>
> Kenneth Klein
> Systems Specialist
> 502-868-3644
> 859-750-5179 (Cell)
> 502-868-2298 (Fax)
> [hidden email]
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: List(byte,byte) cannot be found in class

kenner

You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.

Thanks for looking at the source, Mike M.


-- This example is from the book _Java in a Nutshell_ by David Flanagan.
-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.
-- You may study, use, modify, and distribute this example for any purpose.
-- This example is provided WITHOUT WARRANTY either expressed or implied.
import FileLister;
import FileViewer;
import EndsWithFilter;
class FileLister extends Frame public
trace results
properties private
   dirList=java.awt.List;
   infoArea=TextField
   buttons=Panel
   parent=Button; quit=Button
   filter=FilenameFilter
   cwd=File
   entries=String[]

-- Create the graphical user interface, and list the initial directory.
method FileLister(directory=String, f=FilenameFilter) public

   super("File Lister")
   this.filter = f
   dirList = java.awt.List(12, 0)
   infoarea = TextField()
   infoarea.setEditable(0)
   buttons = Panel()
   parent = Button("Up a Directory");
   quit = Button("Quit");
   buttons.add(parent);
   buttons.add(quit);
   this.add("Center", dirList);
   this.add("South", infoarea);
   this.add("North", buttons);
   this.resize(550, 350);
   this.show();

   -- list the initial directory.
   list_directory(directory);

-- This method uses the list() method to get all entries in a directory
-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public
   dir = File(directory);
       
   if (\dir.isDirectory) then
      Signal IllegalArgumentException("FileLister: no such directory");
   dirList.clear();
   cwd = dir;
   this.setTitle(directory);
       
   entries = cwd.list(filter);
   loop i = 0 to entries.length -1
      dirList.addItem(entries[i]);
   end
   
-- This method uses various File methods to obtain information about
-- a file or directory.  Then it displays that info in a TextField.
method show_info(filename=String) Signals IllegalArgumentException public

   f = File(cwd, filename);
   info=String
       
   if \f.exists then
      Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");
       
   if f.isDirectory then info = "Directory: "
   else info = "File: "
       
   info = info ||filename"    "

   if (f.canRead) then info = info||"read   "
   else info = info||"       "
   if (f.canWrite) then info = info||"write  "
   else info = info||"       "

   info = info ||f.length"   "||java.util.Date(f.lastModified());
       
   infoarea.setText(info);
   
-- This method handles the buttons and list events.
method handleEvent(e=Event) public returns boolean
   if (e.target = quit) then exit 0
   else if (e.target = parent) then do
      p = cwd.getParent()
      if (p = null) then p = "/";  -- Bug workaround
      do
         list_directory(p)
      catch IllegalArgumentException
         infoarea.setText("Already at top");
      end;
      return 1;
--   catch IOException
--      infoarea.setText("I/O Error")
   end
   else if (e.target = dirList) then do
      -- when an item is selected, show its info.
      if (e.id = Event.LIST_SELECT) then do
         show_info(entries[(Integer e.arg).intValue])
--      catch IOException
--         infoarea.setText("I/O Error")
      end
      -- When the user double-clicks, change to the selected directory
      -- or display the selected file.
      else if (e.id = Event.ACTION_EVENT) then do
         item = File(cwd, String e.arg).getAbsolutePath;
         do
            list_directory(item)
         catch IllegalArgumentException
            FileViewer(item)
         end
         return 1;
--      catch IOException
--         infoarea.setText("I/O Error")
      end
   end
   return super.handleEvent(e);

   
method usage public static
   Say "Usage: java FileLister [directory_name] [-e file_extension]"
   exit 0
   
-- Parse command line arguments and create the FileLister object.
-- If an extension is specified, create a FilenameFilter for it.
-- If no directory is specified, use the current directory.
method main(args=String[]) public static
   fl = FilenameFilter null
   directory = String null;
       
   loop i = 0 to args.length - 1
      if args[i] = "-e" then do
         i = i + 1;
         if (i >= args.length) then usage();
         fl = EndsWithFilter(args[i]);
      end
      else do
         if (directory \= null) then usage();  -- Already set
         else directory = args[i]
      end
   end
       
   -- if no directory specified, use the current directoy
   if (directory = null) then directory = System.getProperty("user.dir");
   -- Create the FileLister object
   f = FileLister(directory, fl)

-- This class is a simple FilenameFilter.  It defines the required accept()
-- method to determine whether a specified file should be listed.  A file
-- will be listed if its name ends with the specified extension, or if
-- it is a directory.
class EndsWithFilter implements FilenameFilter
properties private
   extension = String
method EndsWithFilter(ext=String) public
        this.extension = ext;

method accept(dir=File, name=String) public returns boolean
   if (name.endsWith(extension)) then return 1;
   else return (File(dir, name)).isDirectory();



Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

rickmcguire
In your original post, you had the following warning issued:

 6 +++ class FileLister extends Frame public
   +++       ^^^^^^^^^^
   +++ Warning: Public class name changed to same case as program name
'Filelister'
  === class Filelister ===
    constructor FileLister(String,FilenameFilter)
  21 +++    dirList = List(12, 0)
     +++              ^^^^
     +++ Error: The constructor 'List(byte,byte)' cannot be found in
class 'java.util.List'

Have you corrected this problem by changing the filename of the
source?  This will result in a class with the name "Filelister"
getting created rather than "FileLister".  Case is significant, so
that might be the cause of your problem.

Rick


On Wed, Jan 26, 2011 at 9:15 AM,  <[hidden email]> wrote:

>
> You can tell how new I am at this. I'm experimenting with the import
> statements and for some reason I see no trace results in the java console
> where I see the other error info. This is getting executed as an applet from
> a short piece of html under IE.
>
> Thanks for looking at the source, Mike M.
>
>
> -- This example is from the book _Java in a Nutshell_ by David Flanagan.
> -- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.
> -- You may study, use, modify, and distribute this example for any purpose.
> -- This example is provided WITHOUT WARRANTY either expressed or implied.
> import FileLister;
> import FileViewer;
> import EndsWithFilter;
> class FileLister extends Frame public
> trace results
> properties private
>    dirList=java.awt.List;
>    infoArea=TextField
>    buttons=Panel
>    parent=Button; quit=Button
>    filter=FilenameFilter
>    cwd=File
>    entries=String[]
>
> -- Create the graphical user interface, and list the initial directory.
> method FileLister(directory=String, f=FilenameFilter) public
>
>    super("File Lister")
>    this.filter = f
>    dirList = java.awt.List(12, 0)
>    infoarea = TextField()
>    infoarea.setEditable(0)
>    buttons = Panel()
>    parent = Button("Up a Directory");
>    quit = Button("Quit");
>    buttons.add(parent);
>    buttons.add(quit);
>    this.add("Center", dirList);
>    this.add("South", infoarea);
>    this.add("North", buttons);
>    this.resize(550, 350);
>    this.show();
>
>    -- list the initial directory.
>    list_directory(directory);
>
> -- This method uses the list() method to get all entries in a directory
> -- and then displays them in the List component.
> method list_directory(directory=String) Signals IllegalArgumentException
>  public
>    dir = File(directory);
>
>    if (\dir.isDirectory) then
>       Signal IllegalArgumentException("FileLister: no such directory");
>    dirList.clear();
>    cwd = dir;
>    this.setTitle(directory);
>
>    entries = cwd.list(filter);
>    loop i = 0 to entries.length -1
>       dirList.addItem(entries[i]);
>    end
>
> -- This method uses various File methods to obtain information about
> -- a file or directory.  Then it displays that info in a TextField.
> method show_info(filename=String) Signals IllegalArgumentException public
>
>    f = File(cwd, filename);
>    info=String
>
>    if \f.exists then
>       Signal IllegalArgumentException("FileLister.show_info(): no such file
> or directory");
>
>    if f.isDirectory then info = "Directory: "
>    else info = "File: "
>
>    info = info ||filename"    "
>
>    if (f.canRead) then info = info||"read   "
>    else info = info||"       "
>    if (f.canWrite) then info = info||"write  "
>    else info = info||"       "
>
>    info = info ||f.length"   "||java.util.Date(f.lastModified());
>
>    infoarea.setText(info);
>
> -- This method handles the buttons and list events.
> method handleEvent(e=Event) public returns boolean
>    if (e.target = quit) then exit 0
>    else if (e.target = parent) then do
>       p = cwd.getParent()
>       if (p = null) then p = "/";  -- Bug workaround
>       do
>          list_directory(p)
>       catch IllegalArgumentException
>          infoarea.setText("Already at top");
>       end;
>       return 1;
> --   catch IOException
> --      infoarea.setText("I/O Error")
>    end
>    else if (e.target = dirList) then do
>       -- when an item is selected, show its info.
>       if (e.id = Event.LIST_SELECT) then do
>          show_info(entries[(Integer e.arg).intValue])
> --      catch IOException
> --         infoarea.setText("I/O Error")
>       end
>       -- When the user double-clicks, change to the selected directory
>       -- or display the selected file.
>       else if (e.id = Event.ACTION_EVENT) then do
>          item = File(cwd, String e.arg).getAbsolutePath;
>          do
>             list_directory(item)
>          catch IllegalArgumentException
>             FileViewer(item)
>          end
>          return 1;
> --      catch IOException
> --         infoarea.setText("I/O Error")
>       end
>    end
>    return super.handleEvent(e);
>
>
> method usage public static
>    Say "Usage: java FileLister [directory_name] [-e file_extension]"
>    exit 0
>
> -- Parse command line arguments and create the FileLister object.
> -- If an extension is specified, create a FilenameFilter for it.
> -- If no directory is specified, use the current directory.
> method main(args=String[]) public static
>    fl = FilenameFilter null
>    directory = String null;
>
>    loop i = 0 to args.length - 1
>       if args[i] = "-e" then do
>          i = i + 1;
>          if (i >= args.length) then usage();
>          fl = EndsWithFilter(args[i]);
>       end
>       else do
>          if (directory \= null) then usage();  -- Already set
>          else directory = args[i]
>       end
>    end
>
>    -- if no directory specified, use the current directoy
>    if (directory = null) then directory = System.getProperty("user.dir");
>    -- Create the FileLister object
>    f = FileLister(directory, fl)
>
> -- This class is a simple FilenameFilter.  It defines the required accept()
> -- method to determine whether a specified file should be listed.  A file
> -- will be listed if its name ends with the specified extension, or if
> -- it is a directory.
> class EndsWithFilter implements FilenameFilter
> properties private
>    extension = String
> method EndsWithFilter(ext=String) public
>         this.extension = ext;
>
> method accept(dir=File, name=String) public returns boolean
>    if (name.endsWith(extension)) then return 1;
>    else return (File(dir, name)).isDirectory();
>
>
>
> Kenneth Klein
> Systems Specialist
> 502-868-3644
> 859-750-5179 (Cell)
> 502-868-2298 (Fax)
> [hidden email]
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

kenner

Good catch, Rick, but I have straightened that out. I am now using  _F_ile_Li_ster (FileLister) everywhere. Maybe I should use "*F*ile*L*ister".


Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]



Rick McGuire <[hidden email]>
Sent by: [hidden email]

01/26/2011 10:05 AM

Please respond to
IBM Netrexx <[hidden email]>

To
IBM Netrexx <[hidden email]>
cc
Subject
Re: [Ibm-netrexx] List(byte,byte) cannot be found in class





In your original post, you had the following warning issued:

6 +++ class FileLister extends Frame public
  +++       ^^^^^^^^^^
  +++ Warning: Public class name changed to same case as program name
'Filelister'
 === class Filelister ===
   constructor File
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: List(byte,byte) cannot be found in class

measel
In reply to this post by kenner

Ok, so other than lots of this being depreciated in newer java, here’s what I see:

 

At 110:  Won’t compile because you don’t have a FileViewer method – also this is really really bad form – potentially a loop if it did work

      catch IllegalArgumentException

            FileViewer(item)

         end

 

So I changed it to this: 

 

      catch IllegalArgumentException

            say 'Invalid argument' item

            return

         end

 

When I run that I get the nice file list and the trace in a background window.

 

Cheers

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Wednesday, January 26, 2011 8:16 AM
To: IBM Netrexx
Subject: RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.

Thanks for looking at the source, Mike M.


-- This example is from the book _Java in a Nutshell_ by David Flanagan.
-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.
-- You may study, use, modify, and distribute this example for any purpose.
-- This example is provided WITHOUT WARRANTY either expressed or implied.
import FileLister;
import FileViewer;
import EndsWithFilter;
class FileLister extends Frame public
trace results
properties private
   dirList=java.awt.List;
   infoArea=TextField
   buttons=Panel
   parent=Button; quit=Button
   filter=FilenameFilter
   cwd=File
   entries=String[]

-- Create the graphical user interface, and list the initial directory.
method FileLister(directory=String, f=FilenameFilter) public

   super("File Lister")
   this.filter = f
   dirList = java.awt.List(12, 0)
   infoarea = TextField()
   infoarea.setEditable(0)
   buttons = Panel()
   parent = Button("Up a Directory");
   quit = Button("Quit");
   buttons.add(parent);
   buttons.add(quit);
   this.add("Center", dirList);
   this.add("South", infoarea);
   this.add("North", buttons);
   this.resize(550, 350);
   this.show();

   -- list the initial directory.
   list_directory(directory);

-- This method uses the list() method to get all entries in a directory
-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public
   dir = File(directory);
       
   if (\dir.isDirectory) then
      Signal IllegalArgumentException("FileLister: no such directory");
   dirList.clear();
   cwd = dir;
   this.setTitle(directory);
       
   entries = cwd.list(filter);
   loop i = 0 to entries.length -1
      dirList.addItem(entries[i]);
   end
   
-- This method uses various File methods to obtain information about
-- a file or directory.  Then it displays that info in a TextField.
method show_info(filename=String) Signals IllegalArgumentException public

   f = File(cwd, filename);
   info=String
       
   if \f.exists then
      Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");
       
   if f.isDirectory then info = "Directory: "
   else info = "File: "
       
   info = info ||filename"    "

   if (f.canRead) then info = info||"read   "
   else info = info||"       "
   if (f.canWrite) then info = info||"write  "
   else info = info||"       "

   info = info ||f.length"   "||java.util.Date(f.lastModified());
       
   infoarea.setText(info);
   
-- This method handles the buttons and list events.
method handleEvent(e=Event) public returns boolean
   if (e.target = quit) then exit 0
   else if (e.target = parent) then do
      p = cwd.getParent()
      if (p = null) then p = "/";  -- Bug workaround
      do
         list_directory(p)
      catch IllegalArgumentException
         infoarea.setText("Already at top");
      end;
      return 1;
--   catch IOException
--      infoarea.setText("I/O Error")
   end
   else if (e.target = dirList) then do
      -- when an item is selected, show its info.
      if (e.id = Event.LIST_SELECT) then do
         show_info(entries[(Integer e.arg).intValue])
--      catch IOException
--         infoarea.setText("I/O Error")
      end
      -- When the user double-clicks, change to the selected directory
      -- or display the selected file.
      else if (e.id = Event.ACTION_EVENT) then do
         item = File(cwd, String e.arg).getAbsolutePath;
         do
            list_directory(item)
         catch IllegalArgumentException
            FileViewer(item)
         end
         return 1;
--      catch IOException
--         infoarea.setText("I/O Error")
      end
   end
   return super.handleEvent(e);

   
method usage public static
   Say "Usage: java FileLister [directory_name] [-e file_extension]"
   exit 0
   
-- Parse command line arguments and create the FileLister object.
-- If an extension is specified, create a FilenameFilter for it.
-- If no directory is specified, use the current directory.
method main(args=String[]) public static
   fl = FilenameFilter null
   directory = String null;
       
   loop i = 0 to args.length - 1
      if args[i] = "-e" then do
         i = i + 1;
         if (i >= args.length) then usage();
         fl = EndsWithFilter(args[i]);
      end
      else do
         if (directory \= null) then usage();  -- Already set
         else directory = args[i]
      end
   end
       
   -- if no directory specified, use the current directoy
   if (directory = null) then directory = System.getProperty("user.dir");
   -- Create the FileLister object
   f = FileLister(directory, fl)

-- This class is a simple FilenameFilter.  It defines the required accept()
-- method to determine whether a specified file should be listed.  A file
-- will be listed if its name ends with the specified extension, or if
-- it is a directory.
class EndsWithFilter implements FilenameFilter
properties private
   extension = String
method EndsWithFilter(ext=String) public
        this.extension = ext;

method accept(dir=File, name=String) public returns boolean
   if (name.endsWith(extension)) then return 1;
   else return (File(dir, name)).isDirectory();



Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: List(byte,byte) cannot be found in class

kenner

Thanks for testing it, Mark. The "FileViewer" class is in another file in that directory. My compile is fine, now. And I can run it as an application when I putty into omvs, but without X11 there is no graphics support. I want to run this code as an applet from a stub of html under my IE on Windoze AP.  I'm looking into how applets differ from applications.


Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]



"Measel, Mike" <[hidden email]>
Sent by: [hidden email]

01/26/2011 02:29 PM

Please respond to
IBM Netrexx <[hidden email]>

To
"IBM Netrexx" <[hidden email]>
cc
Subject
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class





Ok, so other than lots of this being depreciated in newer java, here’s what I see:
 
At 110:  Won’t compile because you don’t have a FileViewer method – also this is really really bad form – potentially a loop if it did work
      catch IllegalArgumentException
            FileViewer(item)
         end
 
So I changed it to this:  
 
      catch IllegalArgumentException
            say 'Invalid argument' item
            return
         end
 
When I run that I get the nice file list and the trace in a background window.
 
Cheers
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent:
Wednesday, January 26, 2011 8:16 AM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 

You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.


Thanks for looking at the source, Mike M.



-- This example is from the book _Java in a Nutshell_ by David Flanagan.

-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.

-- You may study, use, modify, and distribute this example for any purpose.

-- This example is provided WITHOUT WARRANTY either expressed or implied.

import FileLister;

import FileViewer;

import EndsWithFilter;

class FileLister extends Frame public
trace results

properties private

  dirList=java.awt.List;

  infoArea=TextField

  buttons=Panel

  parent=Button; quit=Button

  filter=FilenameFilter

  cwd=File

  entries=String[]


-- Create the graphical user interface, and list the initial directory.

method FileLister(directory=String, f=FilenameFilter) public


  super("File Lister")

  this.filter = f

  dirList = java.awt.List(12, 0)

  infoarea = TextField()

  infoarea.setEditable(0)

  buttons = Panel()

  parent = Button("Up a Directory");

  quit = Button("Quit");

  buttons.add(parent);

  buttons.add(quit);

  this.add("Center", dirList);

  this.add("South", infoarea);

  this.add("North", buttons);

  this.resize(550, 350);

  this.show();


  -- list the initial directory.

  list_directory(directory);


-- This method uses the list() method to get all entries in a directory

-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public

  dir = File(directory);

     
 
  if (\dir.isDirectory) then

     Signal IllegalArgumentException("FileLister: no such directory");

  dirList.clear();

  cwd = dir;

  this.setTitle(directory);

       
  entries = cwd.list(filter);

  loop i = 0 to entries.length -1

     dirList.addItem(entries[i]);

  end

   
-- This method uses various File methods to obtain information about

-- a file or directory.  Then it displays that info in a TextField.

method show_info(filename=String) Signals IllegalArgumentException public


  f = File(cwd, filename);

  info=String

       
  if \f.exists then

     Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");

       
  if f.isDirectory then info = "Directory: "

  else info = "File: "

       
  info = info ||filename"    "


  if (f.canRead) then info = info||"read   "

  else info = info||"       "

  if (f.canWrite) then info = info||"write  "

  else info = info||"       "


  info = info ||f.length"   "||java.util.Date(f.lastModified());

     
 
  infoarea.setText(info);

 
 
-- This method handles the buttons and list events.

method handleEvent(e=Event) public returns boolean

  if (e.target = quit) then exit 0

  else if (e.target = parent) then do

     p = cwd.getParent()

     if (p = null) then p = "/";  -- Bug workaround

     do

        list_directory(p)

     catch IllegalArgumentException

        infoarea.setText("Already at top");

     end;

     return 1;

--   catch IOException

--      infoarea.setText("I/O Error")

  end

  else if (e.target = dirList) then do

     -- when an item is selected, show its info.

     if (e.id = Event.LIST_SELECT) then do

        show_info(entries[(Integer e.arg).intValue])

--      catch IOException

--         infoarea.setText("I/O Error")

     end

     -- When the user double-clicks, change to the selected directory

     -- or display the selected file.

     else if (e.id = Event.ACTION_EVENT) then do

        item = File(cwd, String e.arg).getAbsolutePath;

        do

           list_directory(item)

        catch IllegalArgumentException

           FileViewer(item)

        end

        return 1;

--      catch IOException

--         infoarea.setText("I/O Error")

     end

  end

  return super.handleEvent(e);


   
method usage public static

  Say "Usage: java FileLister [directory_name] [-e file_extension]"

  exit 0

   
-- Parse command line arguments and create the FileLister object.

-- If an extension is specified, create a FilenameFilter for it.

-- If no directory is specified, use the current directory.

method main(args=String[]) public static

  fl = FilenameFilter null

  directory = String null;

       
  loop i = 0 to args.length - 1

     if args[i] = "-e" then do

        i = i + 1;

        if (i >= args.length) then usage();

        fl = EndsWithFilter(args[i]);

     end

     else do

        if (directory \= null) then usage();  -- Already set

        else directory = args[i]

     end

  end

       
  -- if no directory specified, use the current directoy

  if (directory = null) then directory = System.getProperty("user.dir");

  -- Create the FileLister object

  f = FileLister(directory, fl)


-- This class is a simple FilenameFilter.  It defines the required accept()

-- method to determine whether a specified file should be listed.  A file

-- will be listed if its name ends with the specified extension, or if

-- it is a directory.

class EndsWithFilter implements FilenameFilter

properties private

  extension = String

method EndsWithFilter(ext=String) public

       this.extension = ext;


method accept(dir=File, name=String) public returns boolean

  if (name.endsWith(extension)) then return 1;

  else return (File(dir, name)).isDirectory();




Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: List(byte,byte) cannot be found in class

measel

Applets are small

Applications are larger

One is for the client

The other for the server

Applets don’t have Main’s and are confined/limited by the browser.

Applets extend the applet class, not the frame which you use if you were writing an application.

Both share some methods like paint().

If you want to run it from omvs, then fire up an http server on omvs. 

Bettter yet, write an http server in NetRexx.   I can show you a sample.  ;-)

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Wednesday, January 26, 2011 2:14 PM
To: IBM Netrexx
Subject: RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


Thanks for testing it, Mark. The "FileViewer" class is in another file in that directory. My compile is fine, now. And I can run it as an application when I putty into omvs, but without X11 there is no graphics support. I want to run this code as an applet from a stub of html under my IE on Windoze AP.  I'm looking into how applets differ from applications.


Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]


"Measel, Mike" <[hidden email]>
Sent by: [hidden email]

01/26/2011 02:29 PM

Please respond to
IBM Netrexx <[hidden email]>

To

"IBM Netrexx" <[hidden email]>

cc

Subject

RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 




Ok, so other than lots of this being depreciated in newer java, here’s what I see:
 
At 110:  Won’t compile because you don’t have a FileViewer method – also this is really really bad form – potentially a loop if it did work
      catch IllegalArgumentException
            FileViewer(item)
         end
 
So I changed it to this:  
 
      catch IllegalArgumentException
            say 'Invalid argument' item
            return
         end
 
When I run that I get the nice file list and the trace in a background window.
 
Cheers
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent:
Wednesday, January 26, 2011 8:16 AM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 

You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.


Thanks for looking at the source, Mike M.



-- This example is from the book _Java in a Nutshell_ by David Flanagan.

-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.

-- You may study, use, modify, and distribute this example for any purpose.

-- This example is provided WITHOUT WARRANTY either expressed or implied.

import FileLister;

import FileViewer;

import EndsWithFilter;

class FileLister extends Frame public
trace results

properties private

  dirList=java.awt.List;

  infoArea=TextField

  buttons=Panel

  parent=Button; quit=Button

  filter=FilenameFilter

  cwd=File

  entries=String[]


-- Create the graphical user interface, and list the initial directory.

method FileLister(directory=String, f=FilenameFilter) public


  super("File Lister")

  this.filter = f

  dirList = java.awt.List(12, 0)

  infoarea = TextField()

  infoarea.setEditable(0)

  buttons = Panel()

  parent = Button("Up a Directory");

  quit = Button("Quit");

  buttons.add(parent);

  buttons.add(quit);

  this.add("Center", dirList);

  this.add("South", infoarea);

  this.add("North", buttons);

  this.resize(550, 350);

  this.show();


  -- list the initial directory.

  list_directory(directory);


-- This method uses the list() method to get all entries in a directory

-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public

  dir = File(directory);

     
 
  if (\dir.isDirectory) then

     Signal IllegalArgumentException("FileLister: no such directory");

  dirList.clear();

  cwd = dir;

  this.setTitle(directory);

       
  entries = cwd.list(filter);

  loop i = 0 to entries.length -1

     dirList.addItem(entries[i]);

  end

   
-- This method uses various File methods to obtain information about

-- a file or directory.  Then it displays that info in a TextField.

method show_info(filename=String) Signals IllegalArgumentException public


  f = File(cwd, filename);

  info=String

       
  if \f.exists then

     Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");

       
  if f.isDirectory then info = "Directory: "

  else info = "File: "

       
  info = info ||filename"    "


  if (f.canRead) then info = info||"read   "

  else info = info||"       "

  if (f.canWrite) then info = info||"write  "

  else info = info||"       "


  info = info ||f.length"   "||java.util.Date(f.lastModified());

     
 
  infoarea.setText(info);

 
 
-- This method handles the buttons and list events.

method handleEvent(e=Event) public returns boolean

  if (e.target = quit) then exit 0

  else if (e.target = parent) then do

     p = cwd.getParent()

     if (p = null) then p = "/";  -- Bug workaround

     do

        list_directory(p)

     catch IllegalArgumentException

        infoarea.setText("Already at top");

     end;

     return 1;

--   catch IOException

--      infoarea.setText("I/O Error")

  end

  else if (e.target = dirList) then do

     -- when an item is selected, show its info.

     if (e.id = Event.LIST_SELECT) then do

        show_info(entries[(Integer e.arg).intValue])

--      catch IOException

--         infoarea.setText("I/O Error")

     end

     -- When the user double-clicks, change to the selected directory

     -- or display the selected file.

     else if (e.id = Event.ACTION_EVENT) then do

        item = File(cwd, String e.arg).getAbsolutePath;

        do

           list_directory(item)

        catch IllegalArgumentException

           FileViewer(item)

        end

        return 1;

--      catch IOException

--         infoarea.setText("I/O Error")

     end

  end

  return super.handleEvent(e);


   
method usage public static

  Say "Usage: java FileLister [directory_name] [-e file_extension]"

  exit 0

   
-- Parse command line arguments and create the FileLister object.

-- If an extension is specified, create a FilenameFilter for it.

-- If no directory is specified, use the current directory.

method main(args=String[]) public static

  fl = FilenameFilter null

  directory = String null;

       
  loop i = 0 to args.length - 1

     if args[i] = "-e" then do

        i = i + 1;

        if (i >= args.length) then usage();

        fl = EndsWithFilter(args[i]);

     end

     else do

        if (directory \= null) then usage();  -- Already set

        else directory = args[i]

     end

  end

       
  -- if no directory specified, use the current directoy

  if (directory = null) then directory = System.getProperty("user.dir");

  -- Create the FileLister object

  f = FileLister(directory, fl)


-- This class is a simple FilenameFilter.  It defines the required accept()

-- method to determine whether a specified file should be listed.  A file

-- will be listed if its name ends with the specified extension, or if

-- it is a directory.

class EndsWithFilter implements FilenameFilter

properties private

  extension = String

method EndsWithFilter(ext=String) public

       this.extension = ext;


method accept(dir=File, name=String) public returns boolean

  if (name.endsWith(extension)) then return 1;

  else return (File(dir, name)).isDirectory();




Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]
_______________________________________________
Ibm-netrexx mailing list
[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

Robert L Hamilton
I don't know what I would do with it -- but I'd like to see a copy.
 
BOBH

On Wed, Jan 26, 2011 at 4:51 PM, Measel, Mike <[hidden email]> wrote:

Applets are small

Applications are larger

One is for the client

The other for the server

Applets don’t have Main’s and are confined/limited by the browser.

Applets extend the applet class, not the frame which you use if you were writing an application.

Both share some methods like paint().

If you want to run it from omvs, then fire up an http server on omvs. 

Bettter yet, write an http server in NetRexx.   I can show you a sample.  ;-)

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Wednesday, January 26, 2011 2:14 PM


To: IBM Netrexx
Subject: RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


Thanks for testing it, Mark. The "FileViewer" class is in another file in that directory. My compile is fine, now. And I can run it as an application when I putty into omvs, but without X11 there is no graphics support. I want to run this code as an applet from a stub of html under my IE on Windoze AP.  I'm looking into how applets differ from applications.


Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]


"Measel, Mike" <[hidden email]>
Sent by: [hidden email]

01/26/2011 02:29 PM

Please respond to
IBM Netrexx <[hidden email]>

To

"IBM Netrexx" <[hidden email]>

cc

Subject

RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 




Ok, so other than lots of this being depreciated in newer java, here’s what I see:
 
At 110:  Won’t compile because you don’t have a FileViewer method – also this is really really bad form – potentially a loop if it did work
      catch IllegalArgumentException
            FileViewer(item)
         end
 
So I changed it to this:  
 
      catch IllegalArgumentException
            say 'Invalid argument' item
            return
         end
 
When I run that I get the nice file list and the trace in a background window.
 
Cheers
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent:
Wednesday, January 26, 2011 8:16 AM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 

You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.


Thanks for looking at the source, Mike M.



-- This example is from the book _Java in a Nutshell_ by David Flanagan.

-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.

-- You may study, use, modify, and distribute this example for any purpose.

-- This example is provided WITHOUT WARRANTY either expressed or implied.

import FileLister;

import FileViewer;

import EndsWithFilter;

class FileLister extends Frame public
trace results

properties private

  dirList=java.awt.List;

  infoArea=TextField

  buttons=Panel

  parent=Button; quit=Button

  filter=FilenameFilter

  cwd=File

  entries=String[]


-- Create the graphical user interface, and list the initial directory.

method FileLister(directory=String, f=FilenameFilter) public


  super("File Lister")

  this.filter = f

  dirList = java.awt.List(12, 0)

  infoarea = TextField()

  infoarea.setEditable(0)

  buttons = Panel()

  parent = Button("Up a Directory");

  quit = Button("Quit");

  buttons.add(parent);

  buttons.add(quit);

  this.add("Center", dirList);

  this.add("South", infoarea);

  this.add("North", buttons);

  this.resize(550, 350);

  this.show();


  -- list the initial directory.

  list_directory(directory);


-- This method uses the list() method to get all entries in a directory

-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public

  dir = File(directory);

     
 
  if (\dir.isDirectory) then

     Signal IllegalArgumentException("FileLister: no such directory");

  dirList.clear();

  cwd = dir;

  this.setTitle(directory);

       
  entries = cwd.list(filter);

  loop i = 0 to entries.length -1

     dirList.addItem(entries[i]);

  end

   
-- This method uses various File methods to obtain information about

-- a file or directory.  Then it displays that info in a TextField.

method show_info(filename=String) Signals IllegalArgumentException public


  f = File(cwd, filename);

  info=String

       
  if \f.exists then

     Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");

       
  if f.isDirectory then info = "Directory: "

  else info = "File: "

       
  info = info ||filename"    "


  if (f.canRead) then info = info||"read   "

  else info = info||"       "

  if (f.canWrite) then info = info||"write  "

  else info = info||"       "


  info = info ||f.length"   "||java.util.Date(f.lastModified());

     
 
  infoarea.setText(info);

 
 
-- This method handles the buttons and list events.

method handleEvent(e=Event) public returns boolean

  if (e.target = quit) then exit 0

  else if (e.target = parent) then do

     p = cwd.getParent()

     if (p = null) then p = "/";  -- Bug workaround

     do

        list_directory(p)

     catch IllegalArgumentException

        infoarea.setText("Already at top");

     end;

     return 1;

--   catch IOException

--      infoarea.setText("I/O Error")

  end

  else if (e.target = dirList) then do

     -- when an item is selected, show its info.

     if (e.id = Event.LIST_SELECT) then do

        show_info(entries[(Integer e.arg).intValue])

--      catch IOException

--         infoarea.setText("I/O Error")

     end

     -- When the user double-clicks, change to the selected directory

     -- or display the selected file.

     else if (e.id = Event.ACTION_EVENT) then do

        item = File(cwd, String e.arg).getAbsolutePath;

        do

           list_directory(item)

        catch IllegalArgumentException

           FileViewer(item)

        end

        return 1;

--      catch IOException

--         infoarea.setText("I/O Error")

     end

  end

  return super.handleEvent(e);


   
method usage public static

  Say "Usage: java FileLister [directory_name] [-e file_extension]"

  exit 0

   
-- Parse command line arguments and create the FileLister object.

-- If an extension is specified, create a FilenameFilter for it.

-- If no directory is specified, use the current directory.

method main(args=String[]) public static

  fl = FilenameFilter null

  directory = String null;

       
  loop i = 0 to args.length - 1

     if args[i] = "-e" then do

        i = i + 1;

        if (i >= args.length) then usage();

        fl = EndsWithFilter(args[i]);

     end

     else do

        if (directory \= null) then usage();  -- Already set

        else directory = args[i]

     end

  end

       
  -- if no directory specified, use the current directoy

  if (directory = null) then directory = System.getProperty("user.dir");

  -- Create the FileLister object

  f = FileLister(directory, fl)


-- This class is a simple FilenameFilter.  It defines the required accept()

-- method to determine whether a specified file should be listed.  A file

-- will be listed if its name ends with the specified extension, or if

-- it is a directory.

class EndsWithFilter implements FilenameFilter

properties private

  extension = String

method EndsWithFilter(ext=String) public

       this.extension = ext;


method accept(dir=File, name=String) public returns boolean

  if (name.endsWith(extension)) then return 1;

  else return (File(dir, name)).isDirectory();




Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]
_______________________________________________
Ibm-netrexx mailing list
[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]




_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: List(byte,byte) cannot be found in class

kenner
In reply to this post by measel

Thanks again. Good tips. We do have IBM's HTTPD running on z/os with omvs. Is that what you mean by a server on omvs?


Kenneth Klein



"Measel, Mike" <[hidden email]>
Sent by: [hidden email]

01/26/2011 06:16 PM

Please respond to
IBM Netrexx <[hidden email]>

To
"IBM Netrexx" <[hidden email]>
cc
Subject
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class





Applets are small
Applications are larger
One is for the client
The other for the server
Applets don’t have Main’s and are confined/limited by the browser.
Applets extend the applet class, not the frame which you use if you were writing an application.
Both share some methods like paint().
If you want to run it from omvs, then fire up an http server on omvs.  
Bettter yet, write an http server in NetRexx.   I can show you a sample.  ;-)
 
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent:
Wednesday, January 26, 2011 2:14 PM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 

Thanks for testing it, Mark. The "FileViewer" class is in another file in that directory. My compile is fine, now. And I can run it as an application when I putty into omvs, but without X11 there is no graphics support. I want to run this code as an applet from a stub of html under my IE on Windoze AP.  I'm looking into how applets differ from applications.



Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]

"Measel, Mike" <[hidden email]>
Sent by: [hidden email]

01/26/2011 02:29 PM


Please respond to
IBM Netrexx <[hidden email]>


To
"IBM Netrexx" <[hidden email]>
cc
Subject
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 







Ok, so other than lots of this being depreciated in newer java, here’s what I see:

 
At 110:  Won’t compile because you don’t have a FileViewer method – also this is really really bad form – potentially a loop if it did work

     catch IllegalArgumentException
           FileViewer(item)
        end

 
So I changed it to this:  

 
     catch IllegalArgumentException
           say 'Invalid argument' item

           return

        end

 
When I run that I get the nice file list and the trace in a background window.

 
Cheers

 
From:
[hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent:
Wednesday, January 26, 2011 8:16 AM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.

Thanks for looking at the source, Mike M.



-- This example is from the book _Java in a Nutshell_ by David Flanagan.

-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.

-- You may study, use, modify, and distribute this example for any purpose.

-- This example is provided WITHOUT WARRANTY either expressed or implied.

import FileLister;

import FileViewer;

import EndsWithFilter;

class FileLister extends Frame public
trace results

properties private

 dirList=java.awt.List;

 infoArea=TextField

 buttons=Panel

 parent=Button; quit=Button

 filter=FilenameFilter

 cwd=File

 entries=String[]


-- Create the graphical user interface, and list the initial directory.

method FileLister(directory=String, f=FilenameFilter) public


 super("File Lister")

 this.filter = f

 dirList = java.awt.List(12, 0)

 infoarea = TextField()

 infoarea.setEditable(0)

 buttons = Panel()

 parent = Button("Up a Directory");

 quit = Button("Quit");

 buttons.add(parent);

 buttons.add(quit);

 this.add("Center", dirList);

 this.add("South", infoarea);

 this.add("North", buttons);

 this.resize(550, 350);

 this.show();


 -- list the initial directory.

 list_directory(directory);


-- This method uses the list() method to get all entries in a directory

-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public

 dir = File(directory);

     

 if (\dir.isDirectory) then

    Signal IllegalArgumentException("FileLister: no such directory");

 dirList.clear();

 cwd = dir;

 this.setTitle(directory);

     
 entries = cwd.list(filter);

 loop i = 0 to entries.length -1

    dirList.addItem(entries[i]);

 end

 
-- This method uses various File methods to obtain information about

-- a file or directory.  Then it displays that info in a TextField.

method show_info(filename=String) Signals IllegalArgumentException public


 f = File(cwd, filename);

 info=String

     
 if \f.exists then

    Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");

     
 if f.isDirectory then info = "Directory: "

 else info = "File: "

     
 info = info ||filename"    "


 if (f.canRead) then info = info||"read   "

 else info = info||"       "

 if (f.canWrite) then info = info||"write  "

 else info = info||"       "


 info = info ||f.length"   "||java.util.Date(f.lastModified());

     

 infoarea.setText(info);

 

-- This method handles the buttons and list events.

method handleEvent(e=Event) public returns boolean

 if (e.target = quit) then exit 0

 else if (e.target = parent) then do

    p = cwd.getParent()

    if (p = null) then p = "/";  -- Bug workaround

    do

       list_directory(p)

    catch IllegalArgumentException

       infoarea.setText("Already at top");

    end;

    return 1;

--   catch IOException

--      infoarea.setText("I/O Error")

 end

 else if (e.target = dirList) then do

    -- when an item is selected, show its info.

    if (e.id = Event.LIST_SELECT) then do

       show_info(entries[(Integer e.arg).intValue])

--      catch IOException

--         infoarea.setText("I/O Error")

    end

    -- When the user double-clicks, change to the selected directory

    -- or display the selected file.

    else if (e.id = Event.ACTION_EVENT) then do

       item = File(cwd, String e.arg).getAbsolutePath;

       do

          list_directory(item)

       catch IllegalArgumentException

          FileViewer(item)

       end

       return 1;

--      catch IOException

--         infoarea.setText("I/O Error")

    end

 end

 return super.handleEvent(e);


 
method usage public static

 Say "Usage: java FileLister [directory_name] [-e file_extension]"

 exit 0

 
-- Parse command line arguments and create the FileLister object.

-- If an extension is specified, create a FilenameFilter for it.

-- If no directory is specified, use the current directory.

method main(args=String[]) public static

 fl = FilenameFilter null

 directory = String null;

     
 loop i = 0 to args.length - 1

    if args[i] = "-e" then do

       i = i + 1;

       if (i >= args.length) then usage();

       fl = EndsWithFilter(args[i]);

    end

    else do

       if (directory \= null) then usage();  -- Already set

       else directory = args[i]

    end

 end

     
 -- if no directory specified, use the current directoy

 if (directory = null) then directory = System.getProperty("user.dir");

 -- Create the FileLister object

 f = FileLister(directory, fl)


-- This class is a simple FilenameFilter.  It defines the required accept()

-- method to determine whether a specified file should be listed.  A file

-- will be listed if its name ends with the specified extension, or if

-- it is a directory.

class EndsWithFilter implements FilenameFilter

properties private

 extension = String

method EndsWithFilter(ext=String) public

      this.extension = ext;


method accept(dir=File, name=String) public returns boolean

 if (name.endsWith(extension)) then return 1;

 else return (File(dir, name)).isDirectory();




Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

Robert L Hamilton
try pinging 127.0.0.1
 
bobh

On Thu, Jan 27, 2011 at 8:52 AM, <[hidden email]> wrote:

Thanks again. Good tips. We do have IBM's HTTPD running on z/os with omvs. Is that what you mean by a server on omvs?


Kenneth Klein



"Measel, Mike" <[hidden email]>
Sent by: [hidden email]

01/26/2011 06:16 PM

Please respond to
IBM Netrexx <[hidden email]>

To
"IBM Netrexx" <[hidden email]>
cc
Subject
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class





Applets are small
Applications are larger
One is for the client
The other for the server
Applets don’t have Main’s and are confined/limited by the browser.
Applets extend the applet class, not the frame which you use if you were writing an application.
Both share some methods like paint().
If you want to run it from omvs, then fire up an http server on omvs.  
Bettter yet, write an http server in NetRexx.   I can show you a sample.  ;-)
 
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent:
Wednesday, January 26, 2011 2:14 PM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 

Thanks for testing it, Mark. The "FileViewer" class is in another file in that directory. My compile is fine, now. And I can run it as an application when I putty into omvs, but without X11 there is no graphics support. I want to run this code as an applet from a stub of html under my IE on Windoze AP.  I'm looking into how applets differ from applications.



Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]

"Measel, Mike" <[hidden email]>
Sent by: [hidden email]

01/26/2011 02:29 PM


Please respond to
IBM Netrexx <[hidden email]>


To
"IBM Netrexx" <[hidden email]>
cc
Subject
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 







Ok, so other than lots of this being depreciated in newer java, here’s what I see:

 
At 110:  Won’t compile because you don’t have a FileViewer method – also this is really really bad form – potentially a loop if it did work

     catch IllegalArgumentException
           FileViewer(item)
        end

 
So I changed it to this:  

 
     catch IllegalArgumentException
           say 'Invalid argument' item

           return

        end

 
When I run that I get the nice file list and the trace in a background window.

 
Cheers

 
From:
[hidden email] [mailto:[hidden email]] On Behalf Of [hidden email]
Sent:
Wednesday, January 26, 2011 8:16 AM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.

Thanks for looking at the source, Mike M.



-- This example is from the book _Java in a Nutshell_ by David Flanagan.

-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.

-- You may study, use, modify, and distribute this example for any purpose.

-- This example is provided WITHOUT WARRANTY either expressed or implied.

import FileLister;

import FileViewer;

import EndsWithFilter;

class FileLister extends Frame public
trace results

properties private

 dirList=java.awt.List;

 infoArea=TextField

 buttons=Panel

 parent=Button; quit=Button

 filter=FilenameFilter

 cwd=File

 entries=String[]


-- Create the graphical user interface, and list the initial directory.

method FileLister(directory=String, f=FilenameFilter) public


 super("File Lister")

 this.filter = f

 dirList = java.awt.List(12, 0)

 infoarea = TextField()

 infoarea.setEditable(0)

 buttons = Panel()

 parent = Button("Up a Directory");

 quit = Button("Quit");

 buttons.add(parent);

 buttons.add(quit);

 this.add("Center", dirList);

 this.add("South", infoarea);

 this.add("North", buttons);

 this.resize(550, 350);

 this.show();


 -- list the initial directory.

 list_directory(directory);


-- This method uses the list() method to get all entries in a directory

-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public

 dir = File(directory);

     

 if (\dir.isDirectory) then

    Signal IllegalArgumentException("FileLister: no such directory");

 dirList.clear();

 cwd = dir;

 this.setTitle(directory);

     
 entries = cwd.list(filter);

 loop i = 0 to entries.length -1

    dirList.addItem(entries[i]);

 end

 
-- This method uses various File methods to obtain information about

-- a file or directory.  Then it displays that info in a TextField.

method show_info(filename=String) Signals IllegalArgumentException public


 f = File(cwd, filename);

 info=String

     
 if \f.exists then

    Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");

     
 if f.isDirectory then info = "Directory: "

 else info = "File: "

     
 info = info ||filename"    "


 if (f.canRead) then info = info||"read   "

 else info = info||"       "

 if (f.canWrite) then info = info||"write  "

 else info = info||"       "


 info = info ||f.length"   "||java.util.Date(f.lastModified());

     

 infoarea.setText(info);

 

-- This method handles the buttons and list events.

method handleEvent(e=Event) public returns boolean

 if (e.target = quit) then exit 0

 else if (e.target = parent) then do

    p = cwd.getParent()

    if (p = null) then p = "/";  -- Bug workaround

    do

       list_directory(p)

    catch IllegalArgumentException

       infoarea.setText("Already at top");

    end;

    return 1;

--   catch IOException

--      infoarea.setText("I/O Error")

 end

 else if (e.target = dirList) then do

    -- when an item is selected, show its info.

    if (e.id = Event.LIST_SELECT) then do

       show_info(entries[(Integer e.arg).intValue])

--      catch IOException

--         infoarea.setText("I/O Error")

    end

    -- When the user double-clicks, change to the selected directory

    -- or display the selected file.

    else if (e.id = Event.ACTION_EVENT) then do

       item = File(cwd, String e.arg).getAbsolutePath;

       do

          list_directory(item)

       catch IllegalArgumentException

          FileViewer(item)

       end

       return 1;

--      catch IOException

--         infoarea.setText("I/O Error")

    end

 end

 return super.handleEvent(e);


 
method usage public static

 Say "Usage: java FileLister [directory_name] [-e file_extension]"

 exit 0

 
-- Parse command line arguments and create the FileLister object.

-- If an extension is specified, create a FilenameFilter for it.

-- If no directory is specified, use the current directory.

method main(args=String[]) public static

 fl = FilenameFilter null

 directory = String null;

     
 loop i = 0 to args.length - 1

    if args[i] = "-e" then do

       i = i + 1;

       if (i >= args.length) then usage();

       fl = EndsWithFilter(args[i]);

    end

    else do

       if (directory \= null) then usage();  -- Already set

       else directory = args[i]

    end

 end

     
 -- if no directory specified, use the current directoy

 if (directory = null) then directory = System.getProperty("user.dir");

 -- Create the FileLister object

 f = FileLister(directory, fl)


-- This class is a simple FilenameFilter.  It defines the required accept()

-- method to determine whether a specified file should be listed.  A file

-- will be listed if its name ends with the specified extension, or if

-- it is a directory.

class EndsWithFilter implements FilenameFilter

properties private

 extension = String

method EndsWithFilter(ext=String) public

      this.extension = ext;


method accept(dir=File, name=String) public returns boolean

 if (name.endsWith(extension)) then return 1;

 else return (File(dir, name)).isDirectory();




Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]




_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

alansam
In reply to this post by kenner


On 27 January 2011 06:52, <[hidden email]> wrote:

Thanks again. Good tips. We do have IBM's HTTPD running on z/os with omvs. Is that what you mean by a server on omvs?


Kenneth Klein


IBM's HTTPD is indeed a web server.  It's a customized version of the good old Apache web server.

Can you get to it from your web browser?  http://your.host.name.or.ip.address.here should work unless someone changed the default listening port.

Alan.

--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

kenner
In reply to this post by Robert L Hamilton

Ping from where? My desktop where my browser runs? A putty session on the mainframe where HTTPD is running?



Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]



Robert Hamilton <[hidden email]>
Sent by: [hidden email]

01/27/2011 10:50 AM

Please respond to
IBM Netrexx <[hidden email]>

To
IBM Netrexx <[hidden email]>
cc
Subject
Re: [Ibm-netrexx] List(byte,byte) cannot be found in class





try pinging 127.0.0.1
 
bobh

On Thu, Jan 27, 2011 at 8:52 AM, <kenneth.klein@...> wrote:

Thanks again. Good tips. We do have IBM's HTTPD running on z/os with omvs. Is that what you mean by a server on omvs?



Kenneth Klein



"Measel, Mike" <Mike.Measel@...>
Sent by:
[hidden email]

01/26/2011 06:16 PM

Please respond to
IBM Netrexx <
[hidden email]>


To
"IBM Netrexx" <[hidden email]>
cc
Subject
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class






Applets are small

Applications are larger

One is for the client

The other for the server

Applets don’t have Main’s and are confined/limited by the browser.

Applets extend the applet class, not the frame which you use if you were writing an application.

Both share some methods like paint().

If you want to run it from omvs, then fire up an http server on omvs.  

Bettter yet, write an http server in NetRexx.   I can show you a sample.  ;-)

 

 

From:
[hidden email] [mailto:[hidden email]] On Behalf Of kenneth.klein@...
Sent:
Wednesday, January 26, 2011 2:14 PM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


Thanks for testing it, Mark. The "FileViewer" class is in another file in that directory. My compile is fine, now. And I can run it as an application when I putty into omvs, but without X11 there is no graphics support. I want to run this code as an applet from a stub of html under my IE on Windoze AP.  I'm looking into how applets differ from applications.



Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)

kenneth.klein@...

"Measel, Mike" <Mike.Measel@...>
Sent by:
[hidden email]

01/26/2011 02:29 PM


Please respond to
IBM Netrexx <
[hidden email]>


To
"IBM Netrexx" <[hidden email]>
cc
Subject
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class


 






Ok, so other than lots of this being depreciated in newer java, here’s what I see:

 

At 110:  Won’t compile because you don’t have a FileViewer method – also this is really really bad form – potentially a loop if it did work

     catch IllegalArgumentException
           FileViewer(item)
        end

 

So I changed it to this:  

 

     catch IllegalArgumentException
           say 'Invalid argument' item

           return

        end

 

When I run that I get the nice file list and the trace in a background window.

 

Cheers

 

From:
[hidden email] [mailto:[hidden email]] On Behalf Of kenneth.klein@...
Sent:
Wednesday, January 26, 2011 8:16 AM
To:
IBM Netrexx
Subject:
RE: [Ibm-netrexx] List(byte,byte) cannot be found in class

 


You can tell how new I am at this. I'm experimenting with the import statements and for some reason I see no trace results in the java console where I see the other error info. This is getting executed as an applet from a short piece of html under IE.

Thanks for looking at the source, Mike M.


-- This example is from the book _Java in a Nutshell_ by David Flanagan.

-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.

-- You may study, use, modify, and distribute this example for any purpose.

-- This example is provided WITHOUT WARRANTY either expressed or implied.

import FileLister;

import FileViewer;

import EndsWithFilter;

class FileLister extends Frame public
trace results

properties private

 dirList=java.awt.List;

 infoArea=TextField

 buttons=Panel

 parent=Button; quit=Button

 filter=FilenameFilter

 cwd=File

 entries=String[]


-- Create the graphical user interface, and list the initial directory.

method FileLister(directory=String, f=FilenameFilter) public


 super("File Lister")

 this.filter = f

 dirList = java.awt.List(12, 0)

 infoarea = TextField()

 infoarea.setEditable(0)

 buttons = Panel()

 parent = Button("Up a Directory");

 quit = Button("Quit");

 buttons.add(parent);

 buttons.add(quit);

 this.add("Center", dirList);

 this.add("South", infoarea);

 this.add("North", buttons);

 this.resize(550, 350);

 this.show();


 -- list the initial directory.

 list_directory(directory);


-- This method uses the list() method to get all entries in a directory

-- and then displays them in the List component.
method list_directory(directory=String) Signals IllegalArgumentException  public

 dir = File(directory);

     

 if (\dir.isDirectory) then

    Signal IllegalArgumentException("FileLister: no such directory");

 dirList.clear();

 cwd = dir;

 this.setTitle(directory);

     
 entries = cwd.list(filter);

 loop i = 0 to entries.length -1

    dirList.addItem(entries[i]);

 end

 
-- This method uses various File methods to obtain information about

-- a file or directory.  Then it displays that info in a TextField.

method show_info(filename=String) Signals IllegalArgumentException public


 f = File(cwd, filename);

 info=String

     
 if \f.exists then

    Signal IllegalArgumentException("FileLister.show_info(): no such file or directory");

     
 if f.isDirectory then info = "Directory: "

 else info = "File: "

     
 info = info ||filename"    "


 if (f.canRead) then info = info||"read   "

 else info = info||"       "

 if (f.canWrite) then info = info||"write  "

 else info = info||"       "


 info = info ||f.length"   "||java.util.Date(f.lastModified());

     

 infoarea.setText(info);

 

-- This method handles the buttons and list events.

method handleEvent(e=Event) public returns boolean

 if (e.target = quit) then exit 0

 else if (e.target = parent) then do

    p = cwd.getParent()

    if (p = null) then p = "/";  -- Bug workaround

    do

       list_directory(p)

    catch IllegalArgumentException

       infoarea.setText("Already at top");

    end;

    return 1;

--   catch IOException

--      infoarea.setText("I/O Error")

 end

 else if (e.target = dirList) then do

    -- when an item is selected, show its info.

    if (
e.id = Event.LIST_SELECT) then do
       show_info(entries[(Integer e.arg).intValue])

--      catch IOException

--         infoarea.setText("I/O Error")

    end

    -- When the user double-clicks, change to the selected directory

    -- or display the selected file.

    else if (
e.id = Event.ACTION_EVENT) then do
       item = File(cwd, String e.arg).getAbsolutePath;

       do

          list_directory(item)

       catch IllegalArgumentException

          FileViewer(item)

       end

       return 1;

--      catch IOException

--         infoarea.setText("I/O Error")

    end

 end

 return super.handleEvent(e);


 
method usage public static

 Say "Usage: java FileLister [directory_name] [-e file_extension]"

 exit 0

 
-- Parse command line arguments and create the FileLister object.

-- If an extension is specified, create a FilenameFilter for it.

-- If no directory is specified, use the current directory.

method main(args=String[]) public static

 fl = FilenameFilter null

 directory = String null;

     
 loop i = 0 to args.length - 1

    if args[i] = "-e" then do

       i = i + 1;

       if (i >= args.length) then usage();

       fl = EndsWithFilter(args[i]);

    end

    else do

       if (directory \= null) then usage();  -- Already set

       else directory = args[i]

    end

 end

     
 -- if no directory specified, use the current directoy

 if (directory = null) then directory = System.getProperty("user.dir");

 -- Create the FileLister object

 f = FileLister(directory, fl)


-- This class is a simple FilenameFilter.  It defines the required accept()

-- method to determine whether a specified file should be listed.  A file

-- will be listed if its name ends with the specified extension, or if

-- it is a directory.

class EndsWithFilter implements FilenameFilter

properties private

 extension = String

method EndsWithFilter(ext=String) public

      this.extension = ext;


method accept(dir=File, name=String) public returns boolean

 if (name.endsWith(extension)) then return 1;

 else return (File(dir, name)).isDirectory();




Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)

kenneth.klein@..._______________________________________________
Ibm-netrexx mailing list

[hidden email]
_______________________________________________
Ibm-netrexx mailing list

[hidden email]


_______________________________________________
Ibm-netrexx mailing list

[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

kenner
In reply to this post by alansam

The HTTTP server is running and available on the entire network. We use it to offer up documentation, info, manuals, etc. And I can run the applet WordClock on it no problem. I can also run FileLister on my desktop as an application, it has a "main" method. But I can't run Filelister as an applet. I'm looking at Creating Java Aps Using Netrexx now.

Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]



Alan Sampson <[hidden email]>
Sent by: [hidden email]

01/27/2011 12:21 PM

Please respond to
IBM Netrexx <[hidden email]>

To
IBM Netrexx <[hidden email]>
cc
Subject
Re: [Ibm-netrexx] List(byte,byte) cannot be found in class







On 27 January 2011 06:52, <kenneth.klein@...> wrote:

Thanks again. Good tips. We do have IBM's HTTPD running on z/os with omvs. Is that what you mean by a server on omvs?



Kenneth Klein



IBM's HTTPD is indeed a web server.  It's a customized version of the good old Apache web server.

Can you get to it from your web browser? 
http://your.host.name.or.ip.address.here should work unless someone changed the default listening port.

Alan.

--
Can't tweet, won't tweet!
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

alansam
In reply to this post by kenner


On 27 January 2011 10:33, <[hidden email]> wrote:

Ping from where? My desktop where my browser runs? A putty session on the mainframe where HTTPD is running?


Pinging the loopback is unlikely to shed any light on the problem anyway if you know your server is reachable from your desktop.  Be aware though that getting your FileLister to run as an applet won't be the end of your problems.  Java applets are tightly restricted to prevent things like local file system access to prevent them from being used as virus delivery engines.

Alan.

--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

Robert L Hamilton
Maybe TSO,

BOBH

On Thu, Jan 27, 2011 at 1:56 PM, Alan Sampson <[hidden email]> wrote:


On 27 January 2011 10:33, <[hidden email]> wrote:

Ping from where? My desktop where my browser runs? A putty session on the mainframe where HTTPD is running?


Pinging the loopback is unlikely to shed any light on the problem anyway if you know your server is reachable from your desktop.  Be aware though that getting your FileLister to run as an applet won't be the end of your problems.  Java applets are tightly restricted to prevent things like local file system access to prevent them from being used as virus delivery engines.


Alan.

--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]




_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

KP Kirchdörfer
In reply to this post by measel
Hi;

I prefer Java Web Start to work around the limitations of applets in the
sandbox, have full control over GUI etc. and still be able to run it from a
remote https server.

A plus is that way there's no need to explain users how to install first
additional classes and jars, add to classpath etc etc - you can add those as
requirements and install it seamlessly with Java Web Start (NetRexxR.jar for
instance!).  

http://download.oracle.com/javase/1.5.0/docs/guide/javaws/index.html

Note: If you update your app and classes the user has to clear it's cache to
download the latest versions.

kp

Am Mittwoch, 26. Januar 2011, um 23:51:02 schrieb Measel, Mike:

> Applets are small
>
> Applications are larger
>
> One is for the client
>
> The other for the server
>
> Applets don't have Main's and are confined/limited by the browser.
>
> Applets extend the applet class, not the frame which you use if you were
> writing an application.
>
> Both share some methods like paint().
>
> If you want to run it from omvs, then fire up an http server on omvs.
>
> Bettter yet, write an http server in NetRexx.   I can show you a sample.
> ;-)
>
>
>
>
>
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> [hidden email]
> Sent: Wednesday, January 26, 2011 2:14 PM
> To: IBM Netrexx
> Subject: RE: [Ibm-netrexx] List(byte,byte) cannot be found in class
>
>
>
>
> Thanks for testing it, Mark. The "FileViewer" class is in another file
> in that directory. My compile is fine, now. And I can run it as an
> application when I putty into omvs, but without X11 there is no graphics
> support. I want to run this code as an applet from a stub of html under
> my IE on Windoze AP.  I'm looking into how applets differ from
> applications.
>
>
> Kenneth Klein
> Systems Specialist
> 502-868-3644
> 859-750-5179 (Cell)
> 502-868-2298 (Fax)
> [hidden email]
>
>
>
> "Measel, Mike" <[hidden email]>
> Sent by: [hidden email]
>
> 01/26/2011 02:29 PM
>
> Please respond to
> IBM Netrexx <[hidden email]>
>
> To
>
> "IBM Netrexx" <[hidden email]>
>
> cc
>
>
> Subject
>
> RE: [Ibm-netrexx] List(byte,byte) cannot be found in class
>
>
>
>
>
>
>
>
> Ok, so other than lots of this being depreciated in newer java, here's
> what I see:
>
> At 110:  Won't compile because you don't have a FileViewer method - also
> this is really really bad form - potentially a loop if it did work
>       catch IllegalArgumentException
>             FileViewer(item)
>          end
>
> So I changed it to this:
>
>       catch IllegalArgumentException
>             say 'Invalid argument' item
>             return
>          end
>
> When I run that I get the nice file list and the trace in a background
> window.
>
> Cheers
>
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> [hidden email]
> Sent: Wednesday, January 26, 2011 8:16 AM
> To: IBM Netrexx
> Subject: RE: [Ibm-netrexx] List(byte,byte) cannot be found in class
>
>
> You can tell how new I am at this. I'm experimenting with the import
> statements and for some reason I see no trace results in the java
> console where I see the other error info. This is getting executed as an
> applet from a short piece of html under IE.
>
> Thanks for looking at the source, Mike M.
>
>
> -- This example is from the book _Java in a Nutshell_ by David Flanagan.
>
> -- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.
>
> -- You may study, use, modify, and distribute this example for any
> purpose.
> -- This example is provided WITHOUT WARRANTY either expressed or
> implied.
> import FileLister;
> import FileViewer;
> import EndsWithFilter;
> class FileLister extends Frame public
> trace results
> properties private
>   dirList=java.awt.List;
>   infoArea=TextField
>   buttons=Panel
>   parent=Button; quit=Button
>   filter=FilenameFilter
>   cwd=File
>   entries=String[]
>
> -- Create the graphical user interface, and list the initial directory.
> method FileLister(directory=String, f=FilenameFilter) public
>
>   super("File Lister")
>   this.filter = f
>   dirList = java.awt.List(12, 0)
>   infoarea = TextField()
>   infoarea.setEditable(0)
>   buttons = Panel()
>   parent = Button("Up a Directory");
>   quit = Button("Quit");
>   buttons.add(parent);
>   buttons.add(quit);
>   this.add("Center", dirList);
>   this.add("South", infoarea);
>   this.add("North", buttons);
>   this.resize(550, 350);
>   this.show();
>
>   -- list the initial directory.
>   list_directory(directory);
>
> -- This method uses the list() method to get all entries in a directory
> -- and then displays them in the List component.
> method list_directory(directory=String) Signals IllegalArgumentException
> public
>   dir = File(directory);
>
>   if (\dir.isDirectory) then
>      Signal IllegalArgumentException("FileLister: no such directory");
>   dirList.clear();
>   cwd = dir;
>   this.setTitle(directory);
>
>   entries = cwd.list(filter);
>   loop i = 0 to entries.length -1
>      dirList.addItem(entries[i]);
>   end
>
> -- This method uses various File methods to obtain information about
> -- a file or directory.  Then it displays that info in a TextField.
> method show_info(filename=String) Signals IllegalArgumentException
> public
>
>   f = File(cwd, filename);
>   info=String
>
>   if \f.exists then
>      Signal IllegalArgumentException("FileLister.show_info(): no such
> file or directory");
>
>   if f.isDirectory then info = "Directory: "
>   else info = "File: "
>
>   info = info ||filename"    "
>
>   if (f.canRead) then info = info||"read   "
>   else info = info||"       "
>   if (f.canWrite) then info = info||"write  "
>   else info = info||"       "
>
>   info = info ||f.length"   "||java.util.Date(f.lastModified());
>
>   infoarea.setText(info);
>
> -- This method handles the buttons and list events.
> method handleEvent(e=Event) public returns boolean
>   if (e.target = quit) then exit 0
>   else if (e.target = parent) then do
>      p = cwd.getParent()
>      if (p = null) then p = "/";  -- Bug workaround
>      do
>         list_directory(p)
>      catch IllegalArgumentException
>         infoarea.setText("Already at top");
>      end;
>      return 1;
> --   catch IOException
> --      infoarea.setText("I/O Error")
>   end
>   else if (e.target = dirList) then do
>      -- when an item is selected, show its info.
>      if (e.id = Event.LIST_SELECT) then do
>         show_info(entries[(Integer e.arg).intValue])
> --      catch IOException
> --         infoarea.setText("I/O Error")
>      end
>      -- When the user double-clicks, change to the selected directory
>      -- or display the selected file.
>      else if (e.id = Event.ACTION_EVENT) then do
>         item = File(cwd, String e.arg).getAbsolutePath;
>         do
>            list_directory(item)
>         catch IllegalArgumentException
>            FileViewer(item)
>         end
>         return 1;
> --      catch IOException
> --         infoarea.setText("I/O Error")
>      end
>   end
>   return super.handleEvent(e);
>
>
> method usage public static
>   Say "Usage: java FileLister [directory_name] [-e file_extension]"
>   exit 0
>
> -- Parse command line arguments and create the FileLister object.
> -- If an extension is specified, create a FilenameFilter for it.
> -- If no directory is specified, use the current directory.
> method main(args=String[]) public static
>   fl = FilenameFilter null
>   directory = String null;
>
>   loop i = 0 to args.length - 1
>      if args[i] = "-e" then do
>         i = i + 1;
>         if (i >= args.length) then usage();
>         fl = EndsWithFilter(args[i]);
>      end
>      else do
>         if (directory \= null) then usage();  -- Already set
>         else directory = args[i]
>      end
>   end
>
>   -- if no directory specified, use the current directoy
>   if (directory = null) then directory = System.getProperty("user.dir");
>
>   -- Create the FileLister object
>   f = FileLister(directory, fl)
>
> -- This class is a simple FilenameFilter.  It defines the required
> accept()
> -- method to determine whether a specified file should be listed.  A
> file
> -- will be listed if its name ends with the specified extension, or if
> -- it is a directory.
> class EndsWithFilter implements FilenameFilter
> properties private
>   extension = String
> method EndsWithFilter(ext=String) public
>        this.extension = ext;
>
> method accept(dir=File, name=String) public returns boolean
>   if (name.endsWith(extension)) then return 1;
>   else return (File(dir, name)).isDirectory();
>
>
>
> Kenneth Klein
> Systems Specialist
> 502-868-3644
> 859-750-5179 (Cell)
> 502-868-2298 (Fax)
> [hidden email].com___________________________________________
> ____
> Ibm-netrexx mailing list
> [hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: List(byte,byte) cannot be found in class

kenner

Well, now I'm struggling with java web start and it sounds fascinating. But it doesn't seem to be on our Z/os 1.10 system with java

CP1FA A00002T Tue 10:19:08 / % java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pmz64dev-20091106 (SR11 ))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 z/OS s390x-64 j9vmmz6423-20091104 (JIT enabled)
J9VM - 20091103_45935_BHdSMr
JIT  - 20091016_1845_r8
GC   - 20091026_AA)
JCL  - 20091106

although I thought the sun website said that jaws was part of the base install now. I can't find *jnlp* anywhere on the hfs.  

Kenneth Klein
Systems Specialist
502-868-3644
859-750-5179 (Cell)
502-868-2298 (Fax)
[hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

12