Bookmark Topic Watch Topic
  • New Topic

Problem with package statement

 
raghu yeggina
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi friends,

here is a small java program

package com.raghu.scjp.chapter1;
public class JavaBeans{
public static void main(String args[]){
SubJavaBeans jb=new SubJavaBeans();
jb.setSize(10);
jb.isStatus();
System.out.println(jb.isStatus());
jb.setStatus(false);
jb.isStatus();
System.out.println(jb.getSize());
System.out.println(jb.isStatus());
}
}
class SubJavaBeans{
private int size;
private boolean status=true;
public int getSize(){
return size;
}
public void setSize(int size){
this.size=size;
}
public boolean isStatus(){
return status;
}
public void setStatus(boolean status){
this.status=status;
}
}


i have set the classpath and path and java_home variables through the environmental variables in my system.

i am compiling it at commandprompt from d:\raghu folder and the class file is getting placed in the respective d:\raghu\com\raghu\scjp\chapter1 folder

but the problem is that i am getting an error while running the program using 'java' from the commandprompt i'm getting the 'noclassfoundererror' when i try to run from both d:\raghu and d:\raghu\com\raghu\scjp\chapter1

the entire issue is not there when i comment the first line and compile and run it at the same place..

can anyone please help me sort out the problem and suggest how to run this program successfully using the package statement
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Raghu please don't double post the same thing in different forums...
 
    Bookmark Topic Watch Topic
  • New Topic