473,785 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referring to packages

Can anyone explain how i can refer to another package that is at the
same 'level' in the directory structure as the one doing the
referring. i.e given the package structure: -

basedir
| |
package1 package2

how can i gain access to a class within package2 from within a source
file from package1 -- i only seem to b able to access classes within
packages/directories that are BELOW the package doing the referring.
In the context im thinking of i have a GUI package and a number of
DATA packages - i want the GUI classes to be able to access DATA
classes but also want DATA packages to refer to one another -- its not
essential that the classes are organized this way but seems like a
'common-sense' way of dividing up my classes to make them more
manageable.

cheers

P@
Jul 17 '05 #1
2 1468
"Patrick Robinson" <ip****@central .sussex.ac.uk> wrote in message
news:c7******** *************** **@posting.goog le.com...
Can anyone explain how i can refer to another package that is at the
same 'level' in the directory structure as the one doing the
referring. i.e given the package structure: -

basedir
| |
package1 package2

how can i gain access to a class within package2 from within a source
file from package1 -- i only seem to b able to access classes within
packages/directories that are BELOW the package doing the referring.
In the context im thinking of i have a GUI package and a number of
DATA packages - i want the GUI classes to be able to access DATA
classes but also want DATA packages to refer to one another -- its not
essential that the classes are organized this way but seems like a
'common-sense' way of dividing up my classes to make them more
manageable.

cheers

Given:
--Project Folder
----myapp
------gui
Jul 17 '05 #2
"Patrick Robinson" <ip****@central .sussex.ac.uk> wrote in message
news:c7******** *************** **@posting.goog le.com...
Can anyone explain how i can refer to another package that is at the
same 'level' in the directory structure as the one doing the
referring. i.e given the package structure: -

basedir
| |
package1 package2

how can i gain access to a class within package2 from within a source
file from package1 -- i only seem to b able to access classes within
packages/directories that are BELOW the package doing the referring.
In the context im thinking of i have a GUI package and a number of
DATA packages - i want the GUI classes to be able to access DATA
classes but also want DATA packages to refer to one another -- its not
essential that the classes are organized this way but seems like a
'common-sense' way of dividing up my classes to make them more
manageable.

cheers

Oops. Accidental send.

Given:
--Project Folder
----myapp
------gui
------data1
------data2

You'll run the program from "Project Folder" via a command like "java
myapp.gui.MyMai nClass". To access classes in the other packages:
import myapp.gui.*;
import myapp.data1.*;
import myapp.data2.*;
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4016
by: Chris Barker | last post by:
Hi all, We've been having a discussion over on the wxPython-users mailing list about how to deal with multiple versions of wxPython. During the discussion it came up that this isn't a problem faced only by wxPython, but would have to be dealt with by virtually all packages. The root of the problem is what to do when you install a new version of wxPython, and want to be able to keep using the old one. This question comes up frequently...
15
2610
by: Nick Coghlan | last post by:
Python 2.4's -m command line switch only works for modules directly on sys.path. Trying to use it with modules inside packages will fail with a "Module not found" error. This PEP aims to fix that for Python 2.5. Previously, posting of a draft version of the PEP to python-dev and python-list didn't actually generate any responses. I'm not sure if that's an indication that people don't see the restriction to top-level modules as a problem...
2
5432
by: Peter Saffrey | last post by:
(apologies for starting a new thread - Google can't retrieve the other message for some reason) Yes, /usr/lib/python/site-packages is in sys.path. This series of commands should explain what I mean: I've put the Python ID3 module in a sub-directory of site-packages as an illustration. pzs@bonnie:~$ ls /usr/lib/python2.3/site-packages/ ID3.py ID3.pyc ID3.pyo README apt_inst.so apt_pkg.so apt_proxy bsddb3 debconf.py debconf.pyc ...
0
1496
by: Rich Burridge | last post by:
Hi, I work in the Accessibility Program Office at Sun Microsystems. I'm part of a team that is using Python to create a screen reader called Orca, that'll help blind people (and people with low vision) have access to the GNOME desktop for Solaris and Linux. See: http://cvs.gnome.org/viewcvs/*checkout*/orca/docs/doc-set/orca.html
7
2060
by: Oliver Elphick | last post by:
Debian packages of 7.4 have been uploaded to Debian's experimental archive. Because of certain issues with interlocking dependencies, I will not move them to unstable until version 7.3.4-9 is accepted into the testing distribution. This is not a reflection on 7.4's quality but the result of a long-standing blockage in the movement of packages into testing caused by the perl packages. Unfortunately, this means that 7.4 packages won't get...
0
1612
by: klh | last post by:
We just installed DB2 ESE V8 FP12 on our Windows 2003 servers. We also installed the DB2 ADMCL V8 FP12 on our websphere servers. We use the JDBC Type 4 drivers on our websphere servers to directly hit our DB2 Z/OS V7 databases. When we originally set up this environment (DB2 V8 FP8) we had to bind the JDBC type 4 drivers using the syntax: java com.ibm.db2.jcc.DB2Binder -url jdbc:db2://(ip address):(port number)/(system name) -user...
0
1687
by: giovanni gherdovich | last post by:
Hello, first of all: Is this the right place to ask plastek-related questions? I'm trying to make plastex work on my Ubuntu Dapper Drake. For LaTeX, I have the all-in-one package tetex.
9
2100
by: pythonewbie | last post by:
Hi all, I am newbie in Python, my wish would be to create python applications for both Linux/Win32. I am stucked on creating a function to get the Python install directory (and site-packages directory) with a 100% reliable method... My goal is to verify if an/several extension(s) are installed and to automatically install the missing ones on Linux or Win32.
5
2474
by: John Ladasky | last post by:
Hi folks, Running Python 2.5 on both a Windows XP laptop, and an Ubuntu Linux 7.04 desktop. I've gotten tired of maintaining multiple copies of my personal modules that I use over and over. I have copies of these files in the same directory as the main program I happen to be working on at the time. I've also downloaded FANN, and want to use its Python bindings. FANN does not seem to build automatically, like wxWidgets
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.