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 7 of 7

Thread: newbie question: Error: Could not find or load main class Java Result: 1

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default newbie question: Error: Could not find or load main class Java Result: 1

    Hello all,

    I am trying to learn java and I have this error several times:

    Error: Could not find or load main class chinese1.Chinese1
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)

    As you can guess the project name is chinese1.
    But the same problem happened in several other projects, it starts ok then I make a change in the code and I get this error.
    Even If I delete or make comments on the new code it doesn't help!!
    In the chinese1 project i even make a comment of all the code and still has this error!!



    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package chinese1;

    //import java.io.FileInputStream;
    //import javazoom.jl.player.Player;

    /**
    *
    * @author Tiksuv
    */
    public class Chinese1 {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    // TODO code application logic here
    // Chinese ChForm = new Chinese();
    // ChForm.setVisible(true);
    //
    // try {
    // FileInputStream file= new FileInputStream("C:\\ChineseWords\\tu3.mp3");
    // Player playmp3= new Player(file);
    // playmp3.play();
    //
    // } catch (Exception e){
    //
    // }

    }
    }


    I don't get it.
    I work with Netbeans 7.0.1
    I want to understand what I am doing wrong in general because it happened at other projects and also specifically for this project that I am just starting and want to continue without starting it over.

    Thanks in advance,
    Daniel


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

    Default Re: newbie question: Error: Could not find or load main class Java Result: 1

    Sorry, I don't know how your IDE works.
    Is there a .class file created when you compile your code?

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: newbie question: Error: Could not find or load main class Java Result: 1

    Not in this case.
    When there are no problems the class file is created
    What IDE you use/recommend to do a software with a GUI?

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

    Default Re: newbie question: Error: Could not find or load main class Java Result: 1

    I don't have an IDE. I use an enhanced editor.

  5. #5
    Junior Member
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: newbie question: Error: Could not find or load main class Java Result: 1

    I recommend you to use Crimson editor but if NetBeans help you identify your errors then you can use that but Crimson editor has numbers so when you compile them, you can see where your going wrong by which line

  6. #6
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: newbie question: Error: Could not find or load main class Java Result: 1

    Is your file also called Chinese1

  7. #7
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: newbie question: Error: Could not find or load main class Java Result: 1

    Quote Originally Posted by ideaman View Post
    Not in this case.
    When there are no problems the class file is created
    What IDE you use/recommend to do a software with a GUI?
    IDE or editors is a different debate. Well, your project name is chinese1 and your IDE expects a class with the name Chinese1 as you might have been configured it so while creating new project. So, try making a class named Chinese1 and re-compile it.

Similar Threads

  1. Newbie Java Question
    By tinkersp in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 23rd, 2011, 01:41 PM
  2. Replies: 6
    Last Post: November 12th, 2010, 04:40 AM
  3. Replies: 13
    Last Post: October 13th, 2010, 11:20 AM
  4. how to load a class and type cast to that class?
    By chinni in forum Object Oriented Programming
    Replies: 2
    Last Post: November 9th, 2009, 10:18 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