java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook problem












0















I have finished a project in java that use POI 4.0.1 library. I am using a Mac, Eclipse and Java 8 update 201. I do not use Maven or similar. I’ve already read all the 22 past post about the argument but I can’t find a solution. When I test the program (composed by 10 classes with the main) with Eclipse, no problem. All it’s work. But when I try to launch the application from the command line I obtain the following error:



Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
at Applicazione.main(Applicazione.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more


I've already imported in Eclipse all the useful jar from POI. In particular:




  • POI-4.0.1.jar

  • POI-ooxml.jar

  • POI-excelant.jar

  • POI-ooxml-schemas-4.0.1.jar

  • POI-scratchpad.jar


I tried various combinations of the previous jar. I tried to add xmlbeans-3.0.2.jar and others from lib folder. But nothing. In Eclipse it works but from command line no.
I also tried to move the POI folder in Java folder. Nothing is changed.



I also found a file in my project named .classpath. If it can be helpful the content is the following:



<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-4.0.1.jar"/>
<classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-4.0.1.jar"/>
<classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-examples-4.0.1.jar"/>
<classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-excelant-4.0.1.jar"/>
<classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-schemas-4.0.1.jar"/>





</classpath>


Thanks










share|improve this question





























    0















    I have finished a project in java that use POI 4.0.1 library. I am using a Mac, Eclipse and Java 8 update 201. I do not use Maven or similar. I’ve already read all the 22 past post about the argument but I can’t find a solution. When I test the program (composed by 10 classes with the main) with Eclipse, no problem. All it’s work. But when I try to launch the application from the command line I obtain the following error:



    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
    at Applicazione.main(Applicazione.java:17)
    Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more


    I've already imported in Eclipse all the useful jar from POI. In particular:




    • POI-4.0.1.jar

    • POI-ooxml.jar

    • POI-excelant.jar

    • POI-ooxml-schemas-4.0.1.jar

    • POI-scratchpad.jar


    I tried various combinations of the previous jar. I tried to add xmlbeans-3.0.2.jar and others from lib folder. But nothing. In Eclipse it works but from command line no.
    I also tried to move the POI folder in Java folder. Nothing is changed.



    I also found a file in my project named .classpath. If it can be helpful the content is the following:



    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-4.0.1.jar"/>
    <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-4.0.1.jar"/>
    <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-examples-4.0.1.jar"/>
    <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-excelant-4.0.1.jar"/>
    <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-schemas-4.0.1.jar"/>





    </classpath>


    Thanks










    share|improve this question



























      0












      0








      0








      I have finished a project in java that use POI 4.0.1 library. I am using a Mac, Eclipse and Java 8 update 201. I do not use Maven or similar. I’ve already read all the 22 past post about the argument but I can’t find a solution. When I test the program (composed by 10 classes with the main) with Eclipse, no problem. All it’s work. But when I try to launch the application from the command line I obtain the following error:



      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
      at Applicazione.main(Applicazione.java:17)
      Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 1 more


      I've already imported in Eclipse all the useful jar from POI. In particular:




      • POI-4.0.1.jar

      • POI-ooxml.jar

      • POI-excelant.jar

      • POI-ooxml-schemas-4.0.1.jar

      • POI-scratchpad.jar


      I tried various combinations of the previous jar. I tried to add xmlbeans-3.0.2.jar and others from lib folder. But nothing. In Eclipse it works but from command line no.
      I also tried to move the POI folder in Java folder. Nothing is changed.



      I also found a file in my project named .classpath. If it can be helpful the content is the following:



      <?xml version="1.0" encoding="UTF-8"?>
      <classpath>
      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
      <classpathentry kind="src" path="src"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-examples-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-excelant-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-schemas-4.0.1.jar"/>





      </classpath>


      Thanks










      share|improve this question
















      I have finished a project in java that use POI 4.0.1 library. I am using a Mac, Eclipse and Java 8 update 201. I do not use Maven or similar. I’ve already read all the 22 past post about the argument but I can’t find a solution. When I test the program (composed by 10 classes with the main) with Eclipse, no problem. All it’s work. But when I try to launch the application from the command line I obtain the following error:



      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
      at Applicazione.main(Applicazione.java:17)
      Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 1 more


      I've already imported in Eclipse all the useful jar from POI. In particular:




      • POI-4.0.1.jar

      • POI-ooxml.jar

      • POI-excelant.jar

      • POI-ooxml-schemas-4.0.1.jar

      • POI-scratchpad.jar


      I tried various combinations of the previous jar. I tried to add xmlbeans-3.0.2.jar and others from lib folder. But nothing. In Eclipse it works but from command line no.
      I also tried to move the POI folder in Java folder. Nothing is changed.



      I also found a file in my project named .classpath. If it can be helpful the content is the following:



      <?xml version="1.0" encoding="UTF-8"?>
      <classpath>
      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
      <classpathentry kind="src" path="src"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-examples-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-excelant-4.0.1.jar"/>
      <classpathentry kind="lib" path="/Users/path/Desktop/App/poi-4.0.1/poi-ooxml-schemas-4.0.1.jar"/>





      </classpath>


      Thanks







      java eclipse macos






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 20 at 14:34







      user5507798

















      asked Jan 20 at 14:22









      user5507798user5507798

      86




      86
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You need to ensure that libraries that you used are on the class path when running in command line. Since all POI libraries are in the /Users/path/Desktop/App/poi-4.0.1 director you can use:



          java -cp "/Users/path/Desktop/App/poi-4.0.1:." Applicazione


          There is no magic to java.lang.NoClassDefFoundError. You simply don't have the right class path.






          share|improve this answer
























          • I've just tried. I went in my bin directory (/Users/path/Desktop/App/App/bin) and copy your line but I obtained the same error. How can I modify the classpath?

            – user5507798
            Jan 20 at 14:44













          • If it can be useful, my folder is App, on desktop. It contains another 2 folders: POI-4.0.1 and App. The second one contain the code (bin folder and src folder)

            – user5507798
            Jan 20 at 14:58











          • I tried to set the classpath but now the error is: Could not find or load main class Applicazione

            – user5507798
            Jan 20 at 20:50











          • Thanks anyway. I solved my problem reading this stackoverflow.com/questions/4869024/…

            – user5507798
            Jan 23 at 20:26











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54277397%2fjava-lang-noclassdeffounderror-org-apache-poi-ss-usermodel-workbook-problem%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You need to ensure that libraries that you used are on the class path when running in command line. Since all POI libraries are in the /Users/path/Desktop/App/poi-4.0.1 director you can use:



          java -cp "/Users/path/Desktop/App/poi-4.0.1:." Applicazione


          There is no magic to java.lang.NoClassDefFoundError. You simply don't have the right class path.






          share|improve this answer
























          • I've just tried. I went in my bin directory (/Users/path/Desktop/App/App/bin) and copy your line but I obtained the same error. How can I modify the classpath?

            – user5507798
            Jan 20 at 14:44













          • If it can be useful, my folder is App, on desktop. It contains another 2 folders: POI-4.0.1 and App. The second one contain the code (bin folder and src folder)

            – user5507798
            Jan 20 at 14:58











          • I tried to set the classpath but now the error is: Could not find or load main class Applicazione

            – user5507798
            Jan 20 at 20:50











          • Thanks anyway. I solved my problem reading this stackoverflow.com/questions/4869024/…

            – user5507798
            Jan 23 at 20:26
















          0














          You need to ensure that libraries that you used are on the class path when running in command line. Since all POI libraries are in the /Users/path/Desktop/App/poi-4.0.1 director you can use:



          java -cp "/Users/path/Desktop/App/poi-4.0.1:." Applicazione


          There is no magic to java.lang.NoClassDefFoundError. You simply don't have the right class path.






          share|improve this answer
























          • I've just tried. I went in my bin directory (/Users/path/Desktop/App/App/bin) and copy your line but I obtained the same error. How can I modify the classpath?

            – user5507798
            Jan 20 at 14:44













          • If it can be useful, my folder is App, on desktop. It contains another 2 folders: POI-4.0.1 and App. The second one contain the code (bin folder and src folder)

            – user5507798
            Jan 20 at 14:58











          • I tried to set the classpath but now the error is: Could not find or load main class Applicazione

            – user5507798
            Jan 20 at 20:50











          • Thanks anyway. I solved my problem reading this stackoverflow.com/questions/4869024/…

            – user5507798
            Jan 23 at 20:26














          0












          0








          0







          You need to ensure that libraries that you used are on the class path when running in command line. Since all POI libraries are in the /Users/path/Desktop/App/poi-4.0.1 director you can use:



          java -cp "/Users/path/Desktop/App/poi-4.0.1:." Applicazione


          There is no magic to java.lang.NoClassDefFoundError. You simply don't have the right class path.






          share|improve this answer













          You need to ensure that libraries that you used are on the class path when running in command line. Since all POI libraries are in the /Users/path/Desktop/App/poi-4.0.1 director you can use:



          java -cp "/Users/path/Desktop/App/poi-4.0.1:." Applicazione


          There is no magic to java.lang.NoClassDefFoundError. You simply don't have the right class path.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 20 at 14:41









          Karol DowbeckiKarol Dowbecki

          21k93054




          21k93054













          • I've just tried. I went in my bin directory (/Users/path/Desktop/App/App/bin) and copy your line but I obtained the same error. How can I modify the classpath?

            – user5507798
            Jan 20 at 14:44













          • If it can be useful, my folder is App, on desktop. It contains another 2 folders: POI-4.0.1 and App. The second one contain the code (bin folder and src folder)

            – user5507798
            Jan 20 at 14:58











          • I tried to set the classpath but now the error is: Could not find or load main class Applicazione

            – user5507798
            Jan 20 at 20:50











          • Thanks anyway. I solved my problem reading this stackoverflow.com/questions/4869024/…

            – user5507798
            Jan 23 at 20:26



















          • I've just tried. I went in my bin directory (/Users/path/Desktop/App/App/bin) and copy your line but I obtained the same error. How can I modify the classpath?

            – user5507798
            Jan 20 at 14:44













          • If it can be useful, my folder is App, on desktop. It contains another 2 folders: POI-4.0.1 and App. The second one contain the code (bin folder and src folder)

            – user5507798
            Jan 20 at 14:58











          • I tried to set the classpath but now the error is: Could not find or load main class Applicazione

            – user5507798
            Jan 20 at 20:50











          • Thanks anyway. I solved my problem reading this stackoverflow.com/questions/4869024/…

            – user5507798
            Jan 23 at 20:26

















          I've just tried. I went in my bin directory (/Users/path/Desktop/App/App/bin) and copy your line but I obtained the same error. How can I modify the classpath?

          – user5507798
          Jan 20 at 14:44







          I've just tried. I went in my bin directory (/Users/path/Desktop/App/App/bin) and copy your line but I obtained the same error. How can I modify the classpath?

          – user5507798
          Jan 20 at 14:44















          If it can be useful, my folder is App, on desktop. It contains another 2 folders: POI-4.0.1 and App. The second one contain the code (bin folder and src folder)

          – user5507798
          Jan 20 at 14:58





          If it can be useful, my folder is App, on desktop. It contains another 2 folders: POI-4.0.1 and App. The second one contain the code (bin folder and src folder)

          – user5507798
          Jan 20 at 14:58













          I tried to set the classpath but now the error is: Could not find or load main class Applicazione

          – user5507798
          Jan 20 at 20:50





          I tried to set the classpath but now the error is: Could not find or load main class Applicazione

          – user5507798
          Jan 20 at 20:50













          Thanks anyway. I solved my problem reading this stackoverflow.com/questions/4869024/…

          – user5507798
          Jan 23 at 20:26





          Thanks anyway. I solved my problem reading this stackoverflow.com/questions/4869024/…

          – user5507798
          Jan 23 at 20:26




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54277397%2fjava-lang-noclassdeffounderror-org-apache-poi-ss-usermodel-workbook-problem%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Homophylophilia

          Updating UILabel text programmatically using a function

          Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage