• Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime error in Package program  RSS feed

 
suraj pandhi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam getting this error at run time while using this command "java mypack.Accountbalance". I have compiled this source code and got its class file that I have put in mypack package but now its showing this error ..
Here's the code :

Error:
exception in thread "main" java.lang.NoClassDefFoundError: mypack/Ba
at mypack.Accountbalance.main(Accountbalance.java:25)
sed by: java.lang.ClassNotFoundException: mypack.Balance
 
Paweł Baczyński
Bartender
Posts: 2077
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

It works for me. What is your working directory?

Also, please UseCodeTags (← click) when posting. I added them for you this time.

 
suraj pandhi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, yeah i forgot to mention,
my working directory is D:\javaprograms>
then i give command >java mypack.Accountbalance
nd it returns with error
 
Paweł Baczyński
Bartender
Posts: 2077
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove all .class files and recompile. Can you post how you compile? How is the .java file named? Where is it in directory structure?
It would be a good idea to make your starting class public.
 
suraj pandhi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeaah, your suggestion worked.. I rather created new folder in d drive and at compilation it created 2 class files(yeah obvious),
1 for balance and another for accountbal. and successfully run ...
earlier that folder was full of java and class files..
Thanksss a lot
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!