This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go forum!
  • Post Reply 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Why do I get this : " Error: Could not find or load main class stocks.Bond " ?  RSS feed

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code has been adapted from  Java OCA/OCP 8 Programmer Practice Tests, chapter 6 problem 3. The error I was getting is like couldn't load the main method, even though the code seems  ok.  This Error I am getting is :   "Error: Could not find or load main class stocks.Bond"
Can anyone please help me out ?  
Thanks




 
Marshal
Posts: 63485
207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show us the contents of the directory you are running that instruction in.
 
Md Zuanyeed Kamal
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Please show us the contents of the directory you are running that instruction in.



Attached pic is the contents of the package. In my eclipse work space directory, I have lots of packages and programs.
Capture22.PNG
[Thumbnail for Capture22.PNG]
contents in this package
 
Md Zuanyeed Kamal
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Please show us the contents of the directory you are running that instruction in.



I was trying to run another program in eclipse, and was still getting the same error!!
Capture10.PNG
[Thumbnail for Capture10.PNG]
Error: Could not find or load main class figures.Dolls
 
Campbell Ritchie
Marshal
Posts: 63485
207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show us the path to the Bond.class and the Doll.class files. I suspect there may be an error in your configuration for Eclipse.
 
Md Zuanyeed Kamal
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Please show us the path to the Bond.class and the Doll.class files. I suspect there may be an error in your configuration for Eclipse.



for Doll.java
C:\Users\zunayeed\eclipse-workspace\Java_Problems_Packege_Set\src\figures\Dolls.java
for Bond.java
C:\Users\zunayeed\eclipse-workspace\Java_Problems_Packege_Set\src\stocks\Bond.java

for Bond.class and Doll.class, I checked my directories. However, I didn't find the class files in the bin,  C:\Users\zunayeed\eclipse-workspace\Java_Problems_Packege_Set\bin

So, now the problem is:  the source files (.java) are there, but  machine readable  .class files are missing.  Suggest me please how I can fix up this issue.
thanks

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!