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
Re: newbie question: Error: Could not find or load main class Java Result: 1
You have a class Chinese1 in a package chinese1 so the full name of the class is chinese1.Chinese1; and that's how you're supposed to run it:
Code:
java chinese1.Chinese1
kind regards,
Jos
Re: newbie question: Error: Could not find or load main class Java Result: 1
Hi,
I don't "run" anything, I just press the > button (or F6) in netbeans.
I've also opened the command prompt to run what you told me and I still get the same error.
Daniel
Re: newbie question: Error: Could not find or load main class Java Result: 1
What does F6 do? I thought F11 was clean and build in Netbeans?
Re: newbie question: Error: Could not find or load main class Java Result: 1
F11 is Build Main Project
F6 is Run Main Project
Re: newbie question: Error: Could not find or load main class Java Result: 1
Quote:
Originally Posted by
ozzyman
What does F6 do?
Run the main class in your project ;-)
kind regards,
Jos
Re: newbie question: Error: Could not find or load main class Java Result: 1
Quote:
Originally Posted by
ideaman
F11 is Build Main Project
F6 is Run Main Project
And what class are you trying to run?
kind regards,
Jos
Re: newbie question: Error: Could not find or load main class Java Result: 1
Happy New Year!!
I am trying to run the Chinese1 class
What I did so far is this:
I've created a new project Chinese1
Netbeans created the Chinese1.java file I posted here
I also created another class for the GUI and opened it from the main without problems
I then started to do what i saw here: Play mp3 using java.mp4 - YouTube
to add mp3 playing abbility to the program
then I've got the error I posted, even though i remarked the new code it didn't help to get the code running again
The problem is that I get this kind of error on the simplest of programs sometimes
I am trying to learn java with my son and it is really annoying that small code changes in a small program gets me this error and nothing I do can fix it.
That is why also a general question because it is not the first time I get this error.
Is there another java development platform for Windows that can I use to develop software with GUI like Netbeans?
I've tryed Eclipse but the GUI development it is not "built in" like in Netbeans.
I want also to develop to Android, after I got better in java.