title: Matlab cannot see some of my java classes (not all) in jar package
body: <p>I have a problem that is driving me nuts.
  Matlab sees only some of my classes embeded in a JAR file</p>
  
  <p>If I compile the classes outside of a package and add the path to the class in Matlab using javaaddpath, I do not encounter any problem</p>
  
  <p>When I compile the class in a package and then try to access them under Matlab, I have problems. Below some Matlab code</p>
  
  <pre><code>&gt;&gt;javaaddpath('/Users/me/Documents/workspace/EKGTest.jar');
  &gt;&gt;clear java
  &gt;&gt;import com.neurosky.thinkgear.*
  &gt;&gt;methods('EkgSense')
  
  Methods for class com.neurosky.thinkgear.EkgSense:
  
  EkgSense                  getClass                  notify                    reset            
  addTemplate               getClassificationResults  notifyAll                  toString
  equals                    hashCode                  processData               wait   
  
  &gt;&gt;methods('EkgEpoch')
  
  No methods for class EkgEpoch or no class EkgEpoch
  </code></pre>
  
  <p>Now, I look in the package, all of the classes are public. This is a result of <code>jar -tf</code></p>
  
  <pre><code>osx:/Users/me/Documents/workspace&gt; jar tf EKGTest.jar
  META-INF/MANIFEST.MF
  META-INF/REFACTORINGS.XML
  com/
  com/neurosky/
  com/neurosky/thinkgear/
  com/neurosky/thinkgear/EkgEpoch.class
  com/neurosky/thinkgear/EkgEpoch.java
  com/neurosky/thinkgear/EkgParameters.class
  com/neurosky/thinkgear/EkgParameters.java
  com/neurosky/thinkgear/EkgTemplate.class
  com/neurosky/thinkgear/EkgTemplate.java
  com/neurosky/thinkgear/Matlab.class
  com/neurosky/thinkgear/Matlab.java
  com/neurosky/thinkgear/EkgSense.class
  com/neurosky/thinkgear/EkgSense.java
  com/neurosky/thinkgear/DistanceArray.class
  com/neurosky/thinkgear/DistanceArray.java
  </code></pre>
  
  <p>and below of <code>javap --classpath</code></p>
  
  <pre><code>osx:/Users/me/Documents/workspace&gt; javap -classpath /Users/me/Documents/workspace/EKGTest.jar    com.neurosky.thinkgear.EkgEpoch
  Compiled from "EkgEpoch.java"
  public class com.neurosky.thinkgear.EkgEpoch extends java.lang.Object implements java.lang.Cloneable{
      public int numberOfSamples;
      public float[] data;
      public com.neurosky.thinkgear.EkgEpoch(int);
      public com.neurosky.thinkgear.EkgEpoch(int, float[]);
      public com.neurosky.thinkgear.EkgEpoch(float[]);
      public com.neurosky.thinkgear.EkgEpoch(com.neurosky.thinkgear.EkgEpoch);
      public com.neurosky.thinkgear.EkgEpoch(org.json.JSONArray);
      public org.json.JSONArray toJSONArray();
      public static float[] convolve(float[], float[]);
      public float getLineNoiseAmplitude();
      public com.neurosky.thinkgear.EkgEpoch subtract(com.neurosky.thinkgear.EkgEpoch);
      public com.neurosky.thinkgear.EkgEpoch subEpoch(int, int);
      public com.neurosky.thinkgear.EkgEpoch square();
      public com.neurosky.thinkgear.EkgEpoch subtract(float);
      public com.neurosky.thinkgear.EkgEpoch diff();
      public boolean exceedValue(float, int, int);
      public com.neurosky.thinkgear.EkgEpoch smooth(int);
      public float mean();
      public float sum();
      public float max();
      public float median();
      public com.neurosky.thinkgear.EkgEpoch clone();
      public com.neurosky.thinkgear.EkgEpoch sort();
      public int[] sortIndices(com.neurosky.thinkgear.EkgEpoch);
      public float std();
      public int find_heart_beats(int[], float);
      public com.neurosky.thinkgear.EkgEpoch detrend();
      public java.lang.Object clone()       throws java.lang.CloneNotSupportedException;
  }
  
  osx:/Users/me/Documents/workspace&gt; javap -classpath /Users/me/Documents/workspace/EKGTest.jar  com.neurosky.thinkgear.EkgSense
  Compiled from "EkgSense.java"
  public class com.neurosky.thinkgear.EkgSense extends java.lang.Object{
      public com.neurosky.thinkgear.EkgParameters params;
      public com.neurosky.thinkgear.EkgTemplate[] templates;
      public com.neurosky.thinkgear.EkgTemplate currentData;
      public int lastTemplateInd;
      public float lastEpochValue;
      public com.neurosky.thinkgear.EkgSense(com.neurosky.thinkgear.EkgParameters);
      public void reset();
      public void addTemplate(java.lang.String, float[][]);
      public void addTemplate(com.neurosky.thinkgear.EkgTemplate);
      public java.lang.String getClassificationResults();
      public boolean processData(float[]);
  }
  </code></pre>
  
  <p>I am running Matlab on OSX. I have tried with Matlab 7.7.0.471 (R2008b) and 7.11.0.584 (R2010b) and got the same problem. Both Matlab are using the native OSX Java (Java 1.6.0_26-b03-384-10M3425 with Apple Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode) which should be the same as the one in Eclipse (I have checked and Eclipse compiles with 1.6).</p>
  
  <p>Remember that I can see the missing class no problem when I remove the package statement and some imports at the top of the java files (in all the classes of course) and when I simply add the path to the .class files (not access them in a JAR file).</p>
  
  <p>Any help would be greatly appreciated.
  Thanks,</p>
  
  <p>Jason</p>