P
PortisHead
Hello , I'm new to Java and tried the following.
First I created the file : Getbcard.java
inside the directory : C:\myclasses\exam\test\dok
below is the script :
package exam.test.dok;
public class Getbcard
{
public void setname()
{
System.out.println("Hello");
}
}
then , I compiled it using this command line:
javac Getbcard.java
and got the appropriated .class file:
Getbcard.class
Next , I created a new file , named : Showbcard.java in folder : C:
\examples
below is the script :
import exam.test.dok.*;
public class Showbcard
{
public static void main(String[] args)
{
System.out.println("Showbcard");
Getbcard i = new Getbcard();
i.setname();
}
}
then , I compiled it using this command line:
javac -cp c:\myclasses Showbcard.java
and got the appropriated .class file:
Showbcard.class
Now when I try to execute the file like :
java -cp c:\myclasses Showbcard
I get the error : Could not find or load main class Showbcard
What am I doing wrong here ?
Many , many thanks in advance
First I created the file : Getbcard.java
inside the directory : C:\myclasses\exam\test\dok
below is the script :
package exam.test.dok;
public class Getbcard
{
public void setname()
{
System.out.println("Hello");
}
}
then , I compiled it using this command line:
javac Getbcard.java
and got the appropriated .class file:
Getbcard.class
Next , I created a new file , named : Showbcard.java in folder : C:
\examples
below is the script :
import exam.test.dok.*;
public class Showbcard
{
public static void main(String[] args)
{
System.out.println("Showbcard");
Getbcard i = new Getbcard();
i.setname();
}
}
then , I compiled it using this command line:
javac -cp c:\myclasses Showbcard.java
and got the appropriated .class file:
Showbcard.class
Now when I try to execute the file like :
java -cp c:\myclasses Showbcard
I get the error : Could not find or load main class Showbcard
What am I doing wrong here ?
Many , many thanks in advance