Search code examples
javaeclipsenoclassdeffounderrorarcgisjapplet

Japplet Error: noclassdeffounderror com/esri/map/layer


So I've been trying to get a japplet that uses arcgis sdk jar files to run in a browser and I can't seem to get past this error (noclassdeffounderror com/esri/map/layer). I think this means that I am not exporting my main.jar file with the external arcgis jars but I am not sure as I have tried a few different ways to get the external jars anyways. I have tried referencing them in the html file like so: (with the arcgis lib copied to the folder with Main.jar in it)

<html>
    <body>
      <center>
         <applet
             archive = "Main.jar",
             lib.ArcGIS_Runtime_Java.jar,
             lib.ArcGIS_Runtime_Java_Toolkit.jar
             code = "General.Main"
         >
     </center>
  </body>

I have also tried exporting the jar with the dependencies added however to do this in eclipse it seems that you much have a main(String args[]) method which JApplets cannot have. I have marked the libs and jars needed in buildpath - order and exports.

What am I doing wrong?


Solution

  • What am I doing wrong?

    Start by trying to validate the HTML.

    E.G. this..

    <html>
        <body>
          <center>
             <applet
                 archive = "Main.jar",
                 lib.ArcGIS_Runtime_Java.jar,
                 lib.ArcGIS_Runtime_Java_Toolkit.jar
                 code = "General.Main"
             >
         </center>
      </body>
    

    Should be more like this:

    <html>
        <body>
          <center>
             <applet
                 archive = "Main.jar, lib.ArcGIS_Runtime_Java.jar, lib.ArcGIS_Runtime_Java_Toolkit.jar"
                 code = "General.Main"
                 width = "400"
                 height = "300"
             >
             </applet>
         </center>
      </body>