Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with package statement

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Raghu please don't double post the same thing in different forums...
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic