Package

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

Package

Andreas Zieritz-2
I hope you're not getting angry because I'm asking so much, but...

This time I've got some troubles with Packages - especially how to create
and use them. Packages - I want to use them in form of ZIP-files - are in
my opinion the best way to update a program. There is only one file to
update (Kai Schmidt uses this method in his SurfCompanion).

If I have to classes (A and B), A is the main one and it uses B, where do I
have to write the 'package'-instruction. Do I have to 'import' something or
do I just take the 'uses B'-instruction.

Until now I just get 'class B not found' errors when compiling.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: Package

dIon Gillard/Multitask Consulting/AU
On Mon, 11 May 1998 09:42:14 +0200, Andreas Zieritz wrote:

|   I hope you're not getting angry because I'm asking so much, but...

No. The more the merrier!

|   This time I've got some troubles with Packages - especially how to create
|   and use them. Packages - I want to use them in form of ZIP-files - are in
|   my opinion the best way to update a program. There is only one file to
|   update (Kai Schmidt uses this method in his SurfCompanion).

Do you mean NetRexx packages, or ZIP/JAR files?

|   If I have to classes (A and B), A is the main one and it uses B, where do I
|   have to write the 'package'-instruction. Do I have to 'import' something or
|   do I just take the 'uses B'-instruction.

Say you have two classes A & B, right. I'll assume you mean zip files. You zip the classes together into a zip file, and run
java with the zip file in the classpath.

Ok, now assuming that you actually meant NetRexx packages, A & B go into a package: MyStuff. Code looks like this:

A.Nrx
---------
package MyStuff

class A

method foo; say 'bar'

B.Nrx
-----------
package MyStuff

class B

method foo
        say A().foo()


If two classes are in the same package they always have access to each other. If they aren't in the same package, you'll
need an import. Personally, I always spell out exactly which classes are being imported at the top of my code, e.g.:

OPTIONS BINARY NOCROSSREF

package vnr.ide

import com.sun.java.swing.ImageIcon
import com.sun.java.swing.JFrame
import com.sun.java.swing.JMenuBar
import java.awt.event.ActionEvent
import java.awt.event.ActionListener
import java.awt.event.WindowEvent
import java.awt.event.WindowListener
import vnr.awt.DrawUtils
import vnr.server.LocalServer
import vnr.server.Server
import vnr.util.Log


/**
  * vnrj.nrx prototype Visual NetRexx for Java ide
  * based on ideas discussed with Max...
  * @author 1997-10-29 dlg
  */
class VisualNetRexx -
          adapter -
          implements WindowListener, ActionListener

...etc...

|   Until now I just get 'class B not found' errors when compiling.

Could you post some source or examples??


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

RE: Package

bob.keller
In reply to this post by Andreas Zieritz-2
Hi Andreas:

I had a bit of confusion on doing this myself. The thing to remember is
that the source classes have to exist in a subdirectory. Here is what I
did to create a package of some utilities I'm porting from VM/CMS.  

I created a subdirectory to hold the specific classes for a package
(e.g., c:\utilities\VMCMS)
In each NRX file that I created in the specified subdirectory I placed
the following:

package utilities.VMCMS
          and if needed by the individual classes
import utilities.VMCMS.

I then compiled the class(es).

I then placed the classes in a ZIP file specifying full path
information.

The ZIP file can then be placed in the classpath and the classes
accessed by using the import statement.

Hope this helps.

Best Regards,

Bob <:-)>


 

> -----Original Message-----
> From: Andreas Zieritz [SMTP:[hidden email]]
> Sent: Monday, May 11, 1998 12:42 AM
> To: [hidden email]
> Subject: Package
>
> I hope you're not getting angry because I'm asking so much, but...
>
> This time I've got some troubles with Packages - especially how to
> create
> and use them. Packages - I want to use them in form of ZIP-files - are
> in
> my opinion the best way to update a program. There is only one file to
> update (Kai Schmidt uses this method in his SurfCompanion).
>
> If I have to classes (A and B), A is the main one and it uses B, where
> do I
> have to write the 'package'-instruction. Do I have to 'import'
> something or
> do I just take the 'uses B'-instruction.
>
> Until now I just get 'class B not found' errors when compiling.
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~
> To unsubscribe from this mailing list ( ibm-netrexx ), please send a
> note to
> [hidden email]
> with the following message in the body of the note
> unsubscribe ibm-netrexx <e-mail address>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

RE: Package

Patrick McPhee-3
In reply to this post by Andreas Zieritz-2
When you put the classes in the .zip file, you need to include the
appropriate directory structure. For instance, if your package is
`noodle', and your classes are `a', and `b', the .zip file should
contain
 noodle/a.class
 noodle/b.class

The zip file should be in your classpath as well.

Some versions of the jdk (maybe just on some platforms), don't like it
when you use compression in the .zip file, so try using the -0 option to
info-zip.

In case your problem is just in compiling the things, I'll go to a
little example. Here is a.nrx:

 package noodle;
 class a
  method a()
   say 'hey!'

and here is b.nrx:

 package noodle;
  class b
   method main(s = String[])
    noo = a()

If you put these in a sub-directory of some directory in your class path
called `noodle', you can compile them with
 nrc a b
but you can't compile them with
 nrc b a
and you can't compile them if they aren't in a sub-directory of some
directory in your class called `noodle'.

I hope that allows you to draw your own conclusions.

--
Patrick TJ McPhee
DataMirror Corporation
[hidden email]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: RE: Package

Satguru Shivastava
In reply to this post by Andreas Zieritz-2
HI,
As we are on the subject of paskages,classes & zip files - a brief question
..
how does  one make a browser, like IE4 , which is running  an applet
recoqnize a class zip file.?

Thanks
Satguru


>>> <[hidden email]> 05/11 11:25 AM >>>
Hi Andreas:

I had a bit of confusion on doing this myself. The thing to remember is
that the source classes have to exist in a subdirectory. Here is what I
did to create a package of some utilities I'm porting from VM/CMS.  

I created a subdirectory to hold the specific classes for a package
(e.g., c:\utilities\VMCMS)
In each NRX file that I created in the specified subdirectory I placed
the following:

package utilities.VMCMS
          and if needed by the individual classes
import utilities.VMCMS.

I then compiled the class(es).

I then placed the classes in a ZIP file specifying full path
information.

The ZIP file can then be placed in the classpath and the classes
accessed by using the import statement.

Hope this helps.

Best Regards,

Bob <:-)>


 

> -----Original Message-----
> From: Andreas Zieritz [SMTP:[hidden email]]
> Sent: Monday, May 11, 1998 12:42 AM
> To: [hidden email]
> Subject: Package
>
> I hope you're not getting angry because I'm asking so much, but...
>
> This time I've got some troubles with Packages - especially how to
> create
> and use them. Packages - I want to use them in form of ZIP-files - are
> in
> my opinion the best way to update a program. There is only one file to
> update (Kai Schmidt uses this method in his SurfCompanion).
>
> If I have to classes (A and B), A is the main one and it uses B, where
> do I
> have to write the 'package'-instruction. Do I have to 'import'
> something or
> do I just take the 'uses B'-instruction.
>
> Until now I just get 'class B not found' errors when compiling.
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~
> To unsubscribe from this mailing list ( ibm-netrexx ), please send a
> note to
> [hidden email]
> with the following message in the body of the note
> unsubscribe ibm-netrexx <e-mail address>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note
to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                         
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>