Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes First Java attempt alone - Graph help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "First Java attempt alone - Graph help!" Watch "First Java attempt alone - Graph help!" New topic
Author

First Java attempt alone - Graph help!

Nikki Parks
Greenhorn

Joined: Aug 23, 2011
Posts: 3
Hi.
I'm very much a beginner in Java and I've been asked to write a program to create graphs using data from several other files.
At the moment I'm trying to use SimpleGraph but I keep getting the error
'cannot find symbol - class SimpleGraph'

Does this mean I need to import something? or am I missing an important piece of software?

Please help, I am a little lost!

Thanks
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11160
    
  16

What is a SimpleGraph? I don't see any such class in the API, so where did this class come from?

It's really just about impossible to help you if you don't show us your actual code. You don't need to post ALL of it (especially if it is over about 40-50 lines). Just post enough to show us the problem.

And if you are having this kind of a problem, you shouldn't have more than 10-20 lines anyway.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Nikki Parks
Greenhorn

Joined: Aug 23, 2011
Posts: 3
SimpleGraph was something I found on online Java tutorials, but I can always try and use something else if this is inappropriate.

Here is my code, but ignore the comments as they're things I need to change once I've finished testing the graphs



Nikki Parks
Greenhorn

Joined: Aug 23, 2011
Posts: 3
Here's where I found the simplegraph
http://www2.ph.ed.ac.uk/~wjh/faq/graph/index.html#simple
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11160
    
  16

I've added code tags to your post - it preserves formatting and makes it much easier to read. next time, after you paste in your source code, hilight it and click the 'code' button above. it's just like making text bold or italic.

That tutorial is for how to use a specific package of java code - you would have to download it and configure it to work. Basically, Someone has written a bunch of java, and bundled it into this package. One of the classed they created is this SimpleGraph class. For a first ever java project, this may be a little more than you are ready for. i'm not saying it can't be done, but as a first project...it is questionable. I'm afraid you might get frustrated before you even begin.

Finally, programming is all about being very precise. "simplegraph" is NOT the thing you found. You found something called "SimpleGraph". In java, the case matters, so these two things are not the same. Further, there are conventions everyone uses. Class names have the first letter of each word capitalized. Another java developer can look at "SimpleGraph" and know it refers to a class. If you write "simplegraph", a developer would think this was an instance variable name, but have no idea what the type is...

This may all seem minor to you, but if you are going to talk to other developers (and in that, I include your future self as at some point, you will come back to this code and have to look at it again), you should learn what is expected.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: First Java attempt alone - Graph help!
 
Similar Threads
How to plot a graph in Java ?
Java beginner
About SCJP exam
graphs and applets
synchronizing Swing with data