package statement?

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

package statement?

David Holiday
hi all - having a bit of trouble getting one NetRexx class to see another. the source files are co-located in the same directory and the are set to be in the same package. In stock Java, it's usually sufficient to specify the same package name and so long as both file locations are defined in the classpath it's not a problem to invoke a method from one inside a method from another. however when i try and do this with NetRexx via Eclipse I get an error telling me the interpreter can't find the method or class I'm invoking. i've been going through the pubs and so far I'm not seeing anything that elucidates the nature of the problem. what am i missing here?

thx!
Reply | Threaded
Open this post in threaded view
|

Re: package statement?

Kermit Kiser
Since no one wiser has responded I will try to help a little or at least
provide a path closer to a solution. Unfortunately I don't really
understand your request and if that is true for other readers, it is
possibly the reason for the lack of responses. Given that lack of
understanding and not knowing your background I apologize in advance for
covering basic stuff here:

NetRexx is primarily an interface to Java - the main program is a
"translator" which operates in two modes: compiler and interpreter. The
compiler mode translates NetRexx code to Java code and calls a Java
compiler to output Java class modules which can then be executed in a
JVM (Java Virtual Machine). The interpreter mode creates a structured
representation of NetRexx code in memory and then interprets it within
the initial JVM context. I am not an Eclipse user but I think that
Eclipse handles NetRexx via the compiler mode rather than the
interpreter mode so I am a little confused by your statement that you
received an "interpreter" error message. Did you actually mean a NetRexx
compile error? Or some kind of Java compiler or run time error? Can you
provide the actual error message you received? That might help resolve
the problem.

The NetRexx interpreter normally loads and executes a single module
although advanced usage allows additional source modules to be loaded.
The compiler can compile multiple sources at once but in some cases
dependencies may require compiling module "B" before module "A".
Depending on the package name used in the modules, compiled class files
need a matching directory structure in order to be located although that
is actually a Java requirement as well. It might help to know your
package name and the directory structure where you are placing the class
files along with the related classpath segment you are using to access
them.

Sorry I cannot provide more specific help but your note does not provide
any details about what you are doing or what error message you are seeing.

-- Kermit


On 6/23/2014 8:48 AM, David Holiday wrote:

> hi all - having a bit of trouble getting one NetRexx class to see another.
> the source files are co-located in the same directory and the are set to be
> in the same package. In stock Java, it's usually sufficient to specify the
> same package name and so long as both file locations are defined in the
> classpath it's not a problem to invoke a method from one inside a method
> from another. however when i try and do this with NetRexx via Eclipse I get
> an error telling me the interpreter can't find the method or class I'm
> invoking. i've been going through the pubs and so far I'm not seeing
> anything that elucidates the nature of the problem. what am i missing here?
>
> thx!
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/package-statement-tp4027192.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: package statement?

Dave Woodman
In reply to this post by David Holiday
Hi,

Just one thought:- try right-clicking your project and navigate to Build
Path -> Configure Build Path. In the pane that opens, select the Source tab
- at the bottom is a section  to set the build output folder - try a default
folder of the "src" folder (i.e. <project name>/src).

          Cheers,

                       Dave.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of David Holiday
Sent: 23 June 2014 16:49
To: [hidden email]
Subject: [Ibm-netrexx] package statement?

hi all - having a bit of trouble getting one NetRexx class to see another.
the source files are co-located in the same directory and the are set to be
in the same package. In stock Java, it's usually sufficient to specify the
same package name and so long as both file locations are defined in the
classpath it's not a problem to invoke a method from one inside a method
from another. however when i try and do this with NetRexx via Eclipse I get
an error telling me the interpreter can't find the method or class I'm
invoking. i've been going through the pubs and so far I'm not seeing
anything that elucidates the nature of the problem. what am i missing here?

thx!



--
View this message in context:
http://ibm-netrexx.215625.n3.nabble.com/package-statement-tp4027192.html
Sent from the ibm-netrexx mailing list archive at Nabble.com.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: package statement?

David Holiday
hi all, here is the code in question

file netRexxTest1:

package nrTest;

LOGGER = java.util.logging.Logger.getLogger(netRexxTest1.class.getName())


                LOGGER.setLevel(Level.INFO)
                nr2 = netRexxTest2()
                nr2.buildGUI()




file netRexxTest2:

package nrTest;

import javax.swing.

class netRexxTest2 public extends JFrame

        method buildGUI public
                setSize(800, 600);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               
                rootPaneJDP = JDesktopPane()
                rootPaneJDP.setVisible(1)
               
                jif1 = JInternalFrame()
                jif1.setSize(320, 200)
                jif1.setLocation(250, 250)
               
                jif1.setIconifiable(1)
                jif1.setMaximizable(1)
                jif1.setResizable(1)
                jif1.setVisible(1)
               
                rootPaneJDP.add(jif1);
               
               
                setContentPane(rootPaneJDP);
               
                setVisible(1);





netRexxTest2 compiles without complaint. netRexxTest1 gives this error when I attempt to compile:

NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337
Copyright (c) RexxLA, 2011.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program netRexxTest1.nrx
  7 +++   nr2 = netRexxTest2()
    +++         ^^^^^^^^^^^^
    +++ Error: The method 'netRexxTest2()' cannot be found in class 'nrTest.netRexxTest1' or a superclass
Compilation of 'netRexxTest1.nrx' failed [one error]





I tried the fix Dave suggested - no joy. the files in question are co-located in the project src folder. Also, thanks for clearing that bit up about interpreting v compiling. i didn't realize interpreting wouldn't work with multiple files. also, to answer your implied question, in eclipse there's a NetRexx menu that gets added along with the plugin that allows you to specify Interpret, Translate, Compile, Applet.

cheers,

David
Reply | Threaded
Open this post in threaded view
|

Re: package statement?

Dave Woodman
Sorry, but I have to ask - did you create the package at the Eclipse level
too? And then put the code in src/nrTest?

        Dave.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of David Holiday
Sent: 24 June 2014 21:50
To: [hidden email]
Subject: Re: [Ibm-netrexx] package statement?

hi all, here is the code in question

file netRexxTest1:

package nrTest;

LOGGER = java.util.logging.Logger.getLogger(netRexxTest1.class.getName())


                LOGGER.setLevel(Level.INFO)
                nr2 = netRexxTest2()
                nr2.buildGUI()




file netRexxTest2:

package nrTest;

import javax.swing.

class netRexxTest2 public extends JFrame

        method buildGUI public
                setSize(800, 600);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               
                rootPaneJDP = JDesktopPane()
                rootPaneJDP.setVisible(1)
               
                jif1 = JInternalFrame()
                jif1.setSize(320, 200)
                jif1.setLocation(250, 250)
               
                jif1.setIconifiable(1)
                jif1.setMaximizable(1)
                jif1.setResizable(1)
                jif1.setVisible(1)
               
                rootPaneJDP.add(jif1);
               
               
                setContentPane(rootPaneJDP);
               
                setVisible(1);





netRexxTest2 compiles without complaint. netRexxTest1 gives this error when
I attempt to compile:

NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337
Copyright (c) RexxLA, 2011.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program netRexxTest1.nrx
  7 +++   nr2 = netRexxTest2()
    +++         ^^^^^^^^^^^^
    +++ Error: The method 'netRexxTest2()' cannot be found in class
'nrTest.netRexxTest1' or a superclass Compilation of 'netRexxTest1.nrx'
failed [one error]





I tried the fix Dave suggested - no joy. the files in question are
co-located in the project src folder. Also, thanks for clearing that bit up
about interpreting v compiling. i didn't realize interpreting wouldn't work
with multiple files. also, to answer your implied question, in eclipse
there's a NetRexx menu that gets added along with the plugin that allows you
to specify Interpret, Translate, Compile, Applet.

cheers,

David



--
View this message in context:
http://ibm-netrexx.215625.n3.nabble.com/package-statement-tp4027192p4027195.
html
Sent from the ibm-netrexx mailing list archive at Nabble.com.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: package statement?

David Holiday
oh man. I'm feel like such a dink - that was totally it. I completely forgot Eclipse doesn't hold my hand in the same way it would if I was writing stock Java. I'm going to have to be a much more mindful in future - or maybe just use vi or something where I'm not in the habit of letting the IDE do some of the nit-picky work for me.

t/y!

David
Reply | Threaded
Open this post in threaded view
|

Re: package statement?

Dave Woodman
It was experience of doing the same that led me to ask

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of David Holiday
Sent: 24 June 2014 22:19
To: [hidden email]
Subject: Re: [Ibm-netrexx] package statement?

oh man. I'm feel like such a dink - that was totally it. I completely forgot
Eclipse doesn't hold my hand in the same way it would if I was writing stock
Java. I'm going to have to be a much more mindful in future - or maybe just
use vi or something where I'm not in the habit of letting the IDE do some of
the nit-picky work for me.

t/y!

David



--
View this message in context:
http://ibm-netrexx.215625.n3.nabble.com/package-statement-tp4027192p4027197.
html
Sent from the ibm-netrexx mailing list archive at Nabble.com.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/