1.1 --- a/README.txt Fri Jan 21 18:22:28 2005 +0100
1.2 +++ b/README.txt Sat Jan 22 23:34:27 2005 +0100
1.3 @@ -1,3 +1,21 @@
1.4 +This file contains some information on the essential concepts and principles
1.5 +involved in the use of this software.
1.6 +
1.7 +Installation
1.8 +------------
1.9 +
1.10 +Usually, I issue this command first:
1.11 +
1.12 +python setup.py build
1.13 +
1.14 +The following should, in any case, be sufficient:
1.15 +
1.16 +python setup.py install
1.17 +
1.18 +I don't think distutils supports uninstall, but the installation just adds the
1.19 +java and javaclass packages to your site-packages directory and the
1.20 +runclass.py program to the same bin directory that python resides in.
1.21 +
1.22 Class Search Paths
1.23 ------------------
1.24
1.25 @@ -26,17 +44,14 @@
1.26 Importing Classes
1.27 -----------------
1.28
1.29 -The classhook.py import hook needs to be made available before imports from
1.30 -Java classes and libraries (.jar files) can take place. This can be done
1.31 -by either...
1.32 +In Python, the following statement should be enough to enable Java class
1.33 +import:
1.34
1.35 - * Running the classhook.py file directly and then using the interactive
1.36 - interpreter:
1.37 + import javaclass.classhook
1.38
1.39 - python -i classhook.py
1.40 -
1.41 - * Putting classhook.py in sys.path or PYTHONPATH and importing the
1.42 - classhook module before any code importing Java classes and packages.
1.43 +(Other modules reside in the javaclass package, so it is possible to access
1.44 +them without changing Python's import mechanisms, should such modification be
1.45 +undesirable or unnecessary.)
1.46
1.47 Importing Non-package Classes
1.48 -----------------------------
1.49 @@ -65,23 +80,12 @@
1.50 tests directory would be run as follows:
1.51
1.52 cd tests
1.53 - python ../runclass.py MainTest hello world
1.54 -
1.55 - If runclass.py is executable and on the PATH, then the following can be
1.56 - used instead:
1.57 -
1.58 - cd tests
1.59 runclass.py MainTest hello world
1.60
1.61 * Classes residing in packages can be run by ensuring that the packages
1.62 are registered on the PYTHONPATH (see "Class Search Paths" above). Then,
1.63 the testpackage.MainTest class (for example) would be run as follows:
1.64
1.65 - python runclass.py testpackage.MainTest hello world
1.66 -
1.67 - If runclass.py is executable and on the PATH, then the following can be
1.68 - used instead:
1.69 -
1.70 runclass.py testpackage.MainTest hello world
1.71
1.72 Accessing Python Libraries from Java
1.73 @@ -95,30 +99,32 @@
1.74
1.75 1. Compile the skeleton classes:
1.76
1.77 - javac examples/Qt/qtjava/QWidget.java
1.78 + javac examples/Tkinter/tkjava/*.java
1.79
1.80 2. Compile the Java classes which use the wrapped Python libraries:
1.81
1.82 - javac -classpath examples/Qt examples/Qt/WidgetTest.java
1.83 + javac -classpath examples/Tkinter examples/Tkinter/Application.java
1.84
1.85 3. Run the wrap.py tool on the directory where the skeleton class files
1.86 reside, providing the name of the Python package or module being
1.87 wrapped. This converts the directory into a Python package:
1.88
1.89 - PYTHONPATH=. python tools/wrap.py examples/Qt/qtjava qt
1.90 + python tools/wrap.py examples/Tkinter/tkjava Tkinter
1.91
1.92 - Since the Java class files, if left in the processed directory, would
1.93 - be detected and imported using the classhook.py import hook, and since
1.94 - this would result in two conflicting implementations being imported
1.95 - (with possibly the non-functional Java classes being made available
1.96 - instead of the generated wrapper classes), the wrap.py tool removes all
1.97 - processed class files, leaving only Python source files in the
1.98 - processed directory.
1.99 + Since the Java class files, if left in the processed directory, would be
1.100 + detected and imported using the special import hook, and since this would
1.101 + result in two conflicting implementations being imported (with possibly the
1.102 + non-functional Java classes being made available instead of the generated
1.103 + wrapper classes), the wrap.py tool removes all processed class files,
1.104 + leaving only Python source files in the processed directory.
1.105
1.106 4. The Java classes which use the wrapped Python libraries can now be
1.107 - imported and used as described above. The wrapper package (qtjava in
1.108 + imported and used as described above. The wrapper package (tkjava in
1.109 the above example) needs to reside in sys.path or PYTHONPATH, as must
1.110 - the wrapped library (qt in the above example).
1.111 + the wrapped library (Tkinter in the above example).
1.112 +
1.113 + cd examples/Tkinter
1.114 + runclass.py Application
1.115
1.116 Issues
1.117 ------