title: Unable to import Java classes from Jython module
body: <p><strong>Note:</strong> I found the solution and answered myself. Though, I have no idea why that setting was wrong and caused the problem. I'm still interested in having a good explanation about how Jython import system works; if anyone cares to gain the bounty please answer that.</p>
  
  <hr>
  
  <p>I'm working on an existing Java EE project where I need to do computations in Python. I'm at the first stages of integration tests but I'm already facing an issue. I read <a href="http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html" rel="noreferrer">Chapter 10 of Jython book</a> but still can't find a solution. I also read <a href="http://www.jython.org/jythonbook/en/1.0/ModulesPackages.html" rel="noreferrer">Chapter 8</a> (Modules and Packages for Code Reuse) but to me it'is unclear.</p>
  
  <p>An explanation of how Jython import system works and how to configure it would be very appreciated.</p>
  
  <p><strong>The problem:</strong></p>
  
  <pre><code>$ jython -v
  import: 'exceptions' as org.python.core.exceptions in builtin modules
  Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:54:35) 
  [Java HotSpot(TM) Server VM (Oracle Corporation)] on java1.7.0_10
  import: import site # precompiled from /home/me/jython/2.5.3/Lib/site$py.class
  import: 'sys' as sys in builtin modules
  import: import os # precompiled from /home/me/jython/2.5.3/Lib/os$py.class
  import: 'errno' as org.python.modules.errno in builtin modules
  import: 'posix' as org.python.modules.posix.PosixModule in builtin modules
  import: import posixpath # precompiled from /home/me/jython/2.5.3/Lib/posixpath$py.class
  import: import stat # precompiled from /home/me/jython/2.5.3/Lib/stat$py.class
  import: 'java' as java package
  import: 'File' as java class
  import: 'IOException' as java class
  import: 'org' as java package
  import: 'Py' as java class
  Type "help", "copyright", "credits" or "license" for more information.
  
  &gt;&gt;&gt; import pendulum.generator.BuildingType
  import: import pendulum # precompiled from /path/to/project/build/classes/pendulum/__init__$py.class
  import: import pendulum.generator # precompiled from /path/to/project/build/classes/pendulum/generator/__init__$py.class
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named BuildingType
  </code></pre>
  
  <p>My question is: what am I doing wrong and how do I fix things to import BuildingType interface successfully? Maybe the problem stands in CLASSPATH, but I have no idea which value could be appropriate.</p>
  
  <hr>
  
  <p><strong>Code organization:</strong></p>
  
  <pre><code>$ tree build/classes/pendulum/generator/ src/pendulum/generator/
  build/classes/pendulum/generator/
  ├── BuildingType.class
  ├── __init__.py
  └── __init__$py.class
  
  src/pendulum/generator/
  ├── BuildingType.java
  └── __init__.py
  </code></pre>
  
  <p><strong>Import path defined by a <a href="http://wiki.python.org/jython/JythonFaq/InstallingJython#Where.27s_the_registry_file" rel="noreferrer">private Jython registry file</a>:</strong></p>
  
  <pre><code>$ cat ~/.jython 
  python.path=\
  /path/to/project/build/classes:\
  /path/to/project/src:\
  /home/me/jdevel/extras/2.5.3/Lib:\
  /home/me/jdevel/extras/2.5.3/Lib/site-packages
  </code></pre>
  
  <p>I'm sure Jython picks up the paths because I checked that with <code>sys.path</code> at Jython prompt.</p>
  
  <p><strong>BuildingType.java</strong></p>
  
  <pre><code>package pendulum.generator;
  
  public interface BuildingType {
      public String getBuildingName();
      public String getBuildingAddress();
      public String getBuildingId();
  }
  </code></pre>