Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Not finding main class

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not finding main class

    My application executes smoothly when I Run the project from Netbeans. After a Clean & Build I tried:

    java -jar "/home/eus/NetBeansProjects/HimaraTest/dist/HimaraTest.jar"

    and strangely it gives me the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Sheet
    Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Sheet
            at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    Could not find the main class: himaratest.NewJFrame4. Program will exit.

    Someone can tell me why? What is wrong with the app?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Not finding main class

    ClassNotFoundException: org.apache.poi.ss.usermodel.Sheet
    The java program could NOT find the class that is mentioned in the error message. You probably need to include the jar file that contains that class in the classpath. Your IDE should have a way to add the Class-Path: entry to the manifest file in the jar file and have it point to the jar file with the missing class.

Similar Threads

  1. Refreshing from teh main class
    By lorider93p in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 9th, 2012, 11:12 AM
  2. [SOLVED] How to make a class be static if it's the main class.
    By javapenguin in forum What's Wrong With My Code?
    Replies: 18
    Last Post: January 10th, 2012, 05:14 AM
  3. How do I call a class in a main class
    By Leprechaun_hunter in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 26th, 2011, 03:11 AM
  4. Main Class Not Found Problem
    By shadow in forum Java Theory & Questions
    Replies: 3
    Last Post: September 29th, 2009, 09:42 AM
  5. could not find the main class
    By Tisofa in forum Object Oriented Programming
    Replies: 1
    Last Post: September 27th, 2009, 02:58 AM