• 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
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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

 
Ranch Hand
Posts: 39
  • 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: 64088
215
  • 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: 39
  • 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: 39
  • 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: 64088
215
  • 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: 39
  • 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

 
Maybe he went home and went to bed. And took this tiny ad with him:
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!