Re: newbie: cannot execute HelloWorld



You need to move it into a folder called helloworld (i.e.
c:\helloworld\Main.class) because its in that package (package refers
to directory location) and then you can run from the folder above
helloworld using "java helloworld.Main".

Scott

On Dec 27, 12:25 pm, "R.A.M." <r_ahims...@xxxxxxxxxxxxxx> wrote:
Here source code:

package helloworld;
public class Main {
public Main() {
}
public static void main(String[] args) {
System.out.println("Hello, world!");
}

}U¿ytkownik "R.A.M." <r_ahims...@xxxxxxxxxxxxxx> napisa³ w wiadomo¶cinews:emuig9$fhr$1@xxxxxxxxxxxxxxx

Hello,
I have started learning Java. I have installed Java with NetBeans 5.0. In
NetBeans I have written Hello World application which I can run from IDE
correctly. But when I tried to run it from command prompt (> java
Main.class) I receive:

Exception in thread "main" java.lang.NoClassDefNotFoundError: Main/class

Could you explain me the problem and could you tell me how to solve it?
Thank you!
/RAM/

.



Relevant Pages

  • Getting started with JPype
    ... jpype. ... "Package myclass.HelloWorld is not Callable" ... HelloWorld could not be found. ... - Note that using java ...
    (comp.lang.python)
  • Re: package vs non-pacakged classes : java.lang.NoClassDefFoundError:
    ... It has been a while since I have done anything with stand alone java ... echo ClASSPATH = %CLASSPATH% ... echo Running java HelloWorld ... when I recompiled the class to have the package statement ...
    (comp.lang.java.help)
  • Re: Getting started with JPype
    ... my package is called myclasses and I was referencing ... "Package myclass.HelloWorld is not Callable" ... HelloWorld could not be found. ... - Note that using java ...
    (comp.lang.python)
  • Re: Starting a java class through a bat file
    ... package "Java" or any variant thereof. ... I just copied the project folder from their to the ... Java folder(i created this folder myself). ... The class name is RunAgent. ...
    (comp.lang.java.programmer)
  • Re: Java Hello World running problem
    ... Below is the HelloWorld program: ... tried to run it by the below command java HelloWorld and got errors. ... subfolder world in your current folder, ...
    (comp.lang.java.programmer)