aspose file tools*
The moose likes Beginning Java and the fly likes Problem with package statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Problem with package statement

raghu yeggina
Greenhorn

Joined: Feb 11, 2009
Posts: 27
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

Joined: Aug 03, 2008
Posts: 9304
    
  17

Raghu please don't double post the same thing in different forums...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with package statement