windows - Error java exectuing -
im trying execute simple java code (i have compiled no problems) gives me next error:
c:\users\alejandro\desktop> java helloworld.java error: couldn't find or load main class.
the code next:
public class helloworld{ public static void main(string[] args){ system.out.println("hello world!"); } } -i have set path variable correctly. -i have deleted classpath variable. -i have both files (.java , .class) in desktop.
you're specifying name of source file. that's not provide java command - specify class name.
java helloworld this assumes helloworld.class somewhere on classpath, default "the current directory".
if had package, e.g.
package foo; public class helloworld { ... } then want set helloworld.java in directory called foo, , compile , run root directory:
> javac foo\helloworld.java > java foo.helloworld note how fully-qualified class name foo.helloworld, not foo\helloworld.
java windows
No comments:
Post a Comment