title: Android studio Classnotfound Exception when trying to use Serialization to java server in eclipse
body: <p>I was trying to use <code>ThreadHandler</code> and <code>Thread Communication</code> in the process of 
   using <code>ObjectInputStream</code> and <code>ObjectOutputStream</code>  with a class I made called <code>graphVariable</code> which I have in a server that I made in java, eclipse, I think the problem is that they are not in the same package but I don't know how to make them in the same package, one in eclipse, java and one in android,
  I tried making a package called Objects and putting the <code>graphVariable</code> class in both the server and the client but it doesn't change a thing.
  This is the error:</p>
  
  <pre><code>08-13 14:14:56.949 17040-19174/com.example.ilan.arppcont W/System.err: java.lang.ClassNotFoundException: [LgraphVariable;
  08-13 14:14:56.954 17040-19174/com.example.ilan.arppcont W/System.err:     at java.lang.Class.classForName(Native Method)
  08-13 14:14:56.955 17040-19174/com.example.ilan.arppcont W/System.err:     at java.lang.Class.forName(Class.java:400)
          at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:626)
          at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)
          at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
          at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1664)
          at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1345)
          at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
          at com.example.ilan.arppcont.MyThread.run(class_bitarb.java:35)
  08-13 14:14:56.960 17040-19174/com.example.ilan.arppcont W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "graphVariable" on path: DexPathList[[zip file "/data/app/com.example.ilan.arppcont-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.ilan.arppcont-1/lib/arm64, /system/lib64, /vendor/lib64]]
          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
          ... 9 more
  </code></pre>
  
  <p>This is the code for the client:</p>
  
  <pre><code>package com.example.ilan.arppcont;
  import android.os.Handler;
  import android.os.HandlerThread;
  import android.os.Looper;
  import android.os.Message;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.RecyclerView;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.view.ViewPager;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  
  import ServerComm.Graph;
  import ServerComm.graphVariable;
  
  class MyThread extends Thread {
      boolean running = true;
      HandlerThread myThread = new HandlerThread("hi");
      Looper mLooper;
      @Override
      public void run(){
          if(running) {
              myThread.start();
              mLooper = myThread.getLooper();
              class_bitarb.MyHandler mHandler = new class_bitarb.MyHandler(mLooper);
  
              try {
                  class_server.out.writeObject("update");
                  while (true) {
                      graphVariable[] input = (graphVariable[]) class_server.in.readObject();
                      if (input != null) {
                          class_bitarb.graph = input;
                          break;
                      }
                  }
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              class_graph.graph = Graph.start(class_bitarb.graph, class_graph.textView);
              Message msg = Message.obtain();
              msg.obj = false;
              mHandler.sendMessage(msg);
          }
      };
  
      public void setRunning(boolean running) {
          this.running = running;
      }
  }
  
  public class class_bitarb extends AppCompatActivity {
      static MyThread mThread = new MyThread();
      public static class MyHandler extends Handler {
          public MyHandler(Looper myLooper) {
              super(myLooper);
          }
          public void handleMessage(Message msg) {
              mThread.setRunning(false);
          }
      }
      static Button btn_update;
      static RecyclerView list;
      static graphVariable[] graph = null;
      /**
       * The {@link android.support.v4.view.PagerAdapter} that will provide
       * fragments for each of the sections. We use a
       * {@link FragmentPagerAdapter} derivative, which will keep every
       * loaded fragment in memory. If this becomes too memory intensive, it
       * may be best to switch to a
       * {@link android.support.v4.app.FragmentStatePagerAdapter}.
       */
      private SectionsPagerAdapter mSectionsPagerAdapter;
  
      /**
       * The {@link ViewPager} that will host the section contents.
       */
      private ViewPager mViewPager;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_client);
  
          //Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          //setSupportActionBar(toolbar);
          // Create the adapter that will return a fragment for each of the three
          // primary sections of the activity.
          mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
  
          // Set up the ViewPager with the sections adapter.
          //mViewPager = (ViewPager) findViewById(R.id.container);
          //mViewPager.setAdapter(mSectionsPagerAdapter);
  
          //TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
  
          //mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
          //tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
  
  
      }
  
      static String input = "";
      public static void addListenerOnButton(View view) {
          btn_update.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View arg0) {
  
                  mThread.start();
                  Looper mLooper = mThread.mLooper;
                  while(true){
                      if(mLooper!=null){
                          break;
                      }else{
                          mLooper = mThread.mLooper;
                      }
                  }
  
                  MyHandler mHandler = new MyHandler(mLooper);
  
              }
          });
      }
  
  
      /**
       * A placeholder fragment containing a simple view.
       */
      public static class PlaceholderFragment extends Fragment {
          /**
           * The fragment argument representing the section number for this
           * fragment.
           */
          private static final String ARG_SECTION_NUMBER = "section_number";
  
          public PlaceholderFragment() {
          }
  
          /**
           * Returns a new instance of this fragment for the given section
           * number.
           */
          public static PlaceholderFragment newInstance(int sectionNumber) {
              PlaceholderFragment fragment = new PlaceholderFragment();
              Bundle args = new Bundle();
              args.putInt(ARG_SECTION_NUMBER, sectionNumber);
              fragment.setArguments(args);
              return fragment;
          }
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_bitarb, container, false);
              btn_update = (Button) rootView.findViewById(R.id.btn_update);
              list = (RecyclerView) rootView.findViewById(R.id.list);
              addListenerOnButton(rootView);
              return rootView;
          }
      }
  
      /**
       * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
       * one of the sections/tabs/pages.
       */
      public class SectionsPagerAdapter extends FragmentPagerAdapter {
  
          public SectionsPagerAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int position) {
              // getItem is called to instantiate the fragment for the given page.
              // Return a PlaceholderFragment (defined as a static inner class below).
              return PlaceholderFragment.newInstance(position + 1);
          }
  
          @Override
          public int getCount() {
              // Show 3 total pages.
              return 1;
          }
      }
  }
  </code></pre>
  
  <p>And here is the Class:</p>
  
  <pre><code>public class graphVariable implements Serializable{
      private static final long serialVersionUID = 5830807339573412345L;
      public double x1; 
      public double y1;
      public double[] x;
      public double[] y;
      public APIs ef;
      public APIs et;
      public double ratio;
      public graphVariable() {
          x = new double[50];
          y = new double[50];
          ratio = 0;
          ef= APIs.hi;
          et= APIs.hi;
      }
  }
  </code></pre>
  
  <p>Also, I want to point it out that I have tried lots of stuff.
  Here is the build.gradle:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 28
      defaultConfig {
          applicationId "com.example.ilan.arppcontv2"
          minSdkVersion 15
          targetSdkVersion 28
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(include: ['*.jar'], dir: 'libs')
      implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
      implementation 'com.android.support:design:28.0.0-rc01'
      implementation 'com.android.support.constraint:constraint-layout:1.1.2'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation files('libs/GraphView-4.2.1.jar')
  }
  </code></pre>