title: java.lang.ClassNotFoundException when running trying to open android emulator with appium
body: <p>I am trying to run the following code from Windows in Eclipse and finding the error that I've mentioned in the Title. Can anybody please suggest me.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>package com.apanp.one;
  
  import java.io.File;
  import java.net.MalformedURLException;
  import java.net.URL;    
  import org.openqa.selenium.remote.DesiredCapabilities;    
  import io.appium.java_client.android.AndroidDriver;
  import io.appium.java_client.android.AndroidElement;
  import io.appium.java_client.remote.MobileCapabilityType;
  
  public class base {
  
      public static void main(String[] args) throws MalformedURLException {
  
          File  f = new File("src");
          File fs =new File(f,"original.apk");
  
          DesiredCapabilities cap = new DesiredCapabilities();
          cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Shayan");
          cap.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
          cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
          AndroidDriver&lt;AndroidElement&gt; driver = new AndroidDriver &lt;&gt; (new URL("http://127.0.0.1/wd/hub"), cap);    
      }   
  }
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function
     at java.base/java.lang.ClassLoader.defineClass1(Native Method)
     at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
     at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
     at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
     at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
     at com.apanp.one.base.main(base.java:24)
  Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
     ... 10 more
  </code></pre>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/cw8Ww.png" rel="nofollow noreferrer">AVDManager</a></p>
  
  <p><a href="https://i.stack.imgur.com/gtt3y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gtt3y.png" alt="Virtual Device Manage"></a></p>
  
  <p><strong>Config:</strong></p>
  
  <ol>
  <li><p>JDK 
  JAVA_HOME:C:\Program Files\Java\jdk-14.0.1
  Java bin: C:\Program Files\Java\jdk-14.0.1\bin</p></li>
  <li><p>ANDROID STUDIO DOWNLOAD:<a href="https://developer.android.com/studio" rel="nofollow noreferrer">https://developer.android.com/studio</a>
  ANDROID_HOME=C:\Users\Shahid\AppData\Local\Android\Sdk
  ANDROID-TOOLS-PATH:C:\Users\Shahid\AppData\Local\Android\Sdk\tools
  ANDROID-TOOLS-BIN PATH: C:\Users\Shahid\AppData\Local\Android\Sdk\tools\bin
  ANDROID-PLATFORM-PATH:C:\Users\Shahid\AppData\Local\Android\Sdk\platform-tools</p></li>
  <li><p>CREATE ANDROID EMULATOR IN AVD MANAGER</p></li>
  <li><p>WE CAN INVOKE EMULATOR THROUGH COMMAND PROMPT:C:\Users\Shahid\AppData\Local\Android\Sdk\emulator
  THEN TYPE:emulator -avd Shayan</p></li>
  <li><p>INSTALL node.js:<a href="https://nodejs.org/en/download/" rel="nofollow noreferrer">https://nodejs.org/en/download/</a></p></li>
  <li><p>NODE_HOME:C:\Program Files\nodejs</p></li>
  <li><p>NPM_HOME:C:\Program Files\nodejs\node_modules\npm\bin</p></li>
  <li><p>INSTALL APPIUM SERVER(using npm through command prompt): npm install -g appium</p></li>
  <li><p>SOME COMMANDS WITH APPIUM SERVER: 
      -to start appium server: appium
      -to close appium server: ctrl + C; Y/N-> y and ENTER
              -to check version:appium --version
              -to check where it is: where appium</p></li>
  <li><p>INSTALL APPIUM JAVA CLIENT LIBRARY:<a href="http://appium.io/downloads.html" rel="nofollow noreferrer">http://appium.io/downloads.html</a>; SELECT JAVA; SELECT JAR</p></li>
  <li><p>DOWNLOAD ECLIPSE:<a href="https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020-03/R/eclipse-inst-win64.exe" rel="nofollow noreferrer">https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2020-03/R/eclipse-inst-win64.exe</a></p></li>
  </ol>