title: Android JNI: FindClass() cannot find my class
body: <p>I am trying to use FindClass on one of my Java file in Android, but it never finds the class.</p>
  
  <p>I use the following code (C++):</p>
  
  <pre><code>jclass clsLocal = env-&gt;FindClass("com/device/client/HostConnection");
  </code></pre>
  
  <p>In Eclipse, in src, I have the package com.device.client and the file HostConnection.java in it.</p>
  
  <p>It seems to me that the error has to do with the -classpath. I am not completely sure if that is the problem though. This is a cat of .classpath generated by Eclipse:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;classpath&gt;
      &lt;classpathentry kind="src" path="src"/&gt;
      &lt;classpathentry kind="src" path="gen"/&gt;
      &lt;classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/&gt;
      &lt;classpathentry kind="output" path="bin"/&gt;
  &lt;/classpath&gt;
  </code></pre>
  
  <p>The directory src/ contains the directory com/, which contains device/, which contains client/:</p>
  
  <pre><code>rudys@rudys-N61Jq:~/workspace/DeviceClient/src/com/device/client$ ls
  HostConnection.java  Main.java  ServerConnection.java  SettingsLayout.java
  </code></pre>
  
  <p>I tried to create a rule in the .classpath such as:</p>
  
  <pre><code>&lt;classpathentry kind="src" path="src/com/device/client"/&gt;
  </code></pre>
  
  <p>but Eclipse spots it as a problem (nested with src/), so I believe the path="src/" already takes care of all those subdirectories.</p>
  
  <p>I am not sure what it is not working.</p>
  
  <p>Could anyone please help me?</p>