title: JNI directory structure c and java
body: <p>I've created 3 <code>JNI</code> classes and since I'm new to programming I just had them all in the same file but now I have to set up the directory for them in a professional sense. </p>
  
  <p>This includes <code>src</code> for the source code and <code>bin</code> for the classes but I have no idea where to put the <code>.h</code> and <code>.so</code> files and how to compile everything so it works. </p>
  
  <p><strong>I've tried</strong> to look into classpaths and stuff but I seem to just be stuck and can't get my code to run properly. I'm <strong>also trying</strong> to understand and learn packages for this but I'm stuck on that too.</p>
  
  <pre><code>#spaces are just for easier reading atm
  
  cd /home/pi/git/GPIO_I2C
  mkdir bin
  javac -d bin /home/pi/git/GPIO_I2C/src/com/company/gpioi2c/gpio/GPIOMethods.java -h ./bin
  
  cd bin
  gcc -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -c "com_comapny_gpioi2c_gpio_GPIOMethods.h"
  
  cd /home/pi/git/GPIO_I2C/src/c
  
  gcc -o libmyGPIOMethods.so -shared -fPIC -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux GPIOMethods.c -lc 
  
  sudo cp libmyGPIOMethods.so /usr/lib
  cd /home/pi/git/GPIO_I2C/
  java -cp /home/pi/git/GPIO_I2C/bin/com/company/gpioi2c/gpio GPIOMethods
  </code></pre>
  
  <p>This is <strong>what I've tried</strong> to compile so far for just one of the methods but I'm getting <code>Could not load main class</code> or <code>unsatisfied link error</code> depending on what I've changed?</p>