File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes This must be embarrassingly simple Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "This must be embarrassingly simple" Watch "This must be embarrassingly simple" New topic
Author

This must be embarrassingly simple

Dennis Noren
Greenhorn

Joined: Jan 07, 2005
Posts: 15
With the following code:



I get the compile error:
'cannot resolve symbol' on line
Shape shape1 = new Shape(Color.green, shape1Name);

If I comment out that line, the code compiles successfully but I get the runtime error:

Exception in thread "main" java.lang.NoSuchMethodError: main

What is going on?


Java novice, J2SE 1.4.2<br />Some C, some OOA/OOD
Liam Tiarnach
Ranch Hand

Joined: Aug 06, 2004
Posts: 51
Hmmm...

Let's see...



okay there is where you attempt to instantiate you Shape class, passing the arguement Color.green and shape1Name...
but...

here is your constructor for Shape that take no arguments... So the compiler give you an error...
to fix this you will have to create a constructor that does take Color and StringBuffer as arguements...
[code] Shape (Color colorArg ,StringBuffer stringBufferArg){
// do stuff
}[code]


- Liam...<br />- ' He who never sleeps... '
Dennis Noren
Greenhorn

Joined: Jan 07, 2005
Posts: 15
Thanks -- that fixed it for the compile error. For the runtime error, it was that I needed to name the file the same as the class that had main in it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: This must be embarrassingly simple