Results 1 to 8 of 8
  1. #1
    mr_anderson is offline Member
    Join Date
    May 2010
    Location
    Florida
    Posts
    68
    Rep Power
    0

    Default Help with compile

    Hi
    I am using netbeans 6.8, I build my program and I get the . JAR File.
    My problem is that when I try to run my program from the command line I get this message:
    C:\Users\comm433>java -jar "E:\java projects\PlayingAudio\LSB1\dist\LSB1.jar"
    Exception in thread "main" java.lang.NoClassDefFoundError: lsb1/Main
    Caused by: java.lang.ClassNotFoundException: lsb1.Main
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: lsb1.Main. Program will exit.
    any suggestions

    Best Regards.
    Anderson

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #3
    mr_anderson is offline Member
    Join Date
    May 2010
    Location
    Florida
    Posts
    68
    Rep Power
    0

    Default

    yes i found the main class and it LSB1.class

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    The question was, did you DEFINE the main class -- not whether you found it.

    fn

  5. #5
    mr_anderson is offline Member
    Join Date
    May 2010
    Location
    Florida
    Posts
    68
    Rep Power
    0

    Default

    Thank you guys for help, I checked it again and defined the main class and it is running from the command line now.
    I have another question ( I donot have much experience with java) the program uses .bin files to save and load data the problem is that when I run jar project I get error messages regarding the existance of the .bin files, the question is where to put them?

    Regards.

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,259
    Rep Power
    25

    Default

    when I run jar project I get error messages regarding the existance of the .bin files
    Can you see the path used in the java program when it tries to read the .bin file?
    Put the files there.

  7. #7
    mr_anderson is offline Member
    Join Date
    May 2010
    Location
    Florida
    Posts
    68
    Rep Power
    0

    Default

    Well thank you Norm, I tried the URL Method for locating the files and it worked.

    Thank you again.
    Regards

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by Darryl.Burke View Post
    The question was, did you DEFINE the main class -- not whether you found it.

    fn
    Yeah. If you have more than one main class in your project, when you build it on NetBeans you must define which is the main from the project properties. Even when you run it you have to do that, at that time NetBeans alert you to select the main. But not in build time.

Similar Threads

  1. doesn't compile?!
    By jon80 in forum New To Java
    Replies: 8
    Last Post: 06-14-2008, 05:42 PM
  2. Program Won't Compile
    By JavaLovenJoe in forum New To Java
    Replies: 2
    Last Post: 04-22-2008, 01:31 PM
  3. Compile Trouble
    By adelgado0723 in forum New To Java
    Replies: 5
    Last Post: 04-21-2008, 02:02 AM
  4. How to compile an applet to an exe
    By elizabeth in forum Java Applets
    Replies: 4
    Last Post: 02-18-2008, 03:57 AM
  5. Not able to compile
    By bugger in forum New To Java
    Replies: 2
    Last Post: 01-09-2008, 10:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •