• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cannot find symbol

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help to solve the "cannot find symbol" error on linux:
$ export CLASSPATH=.

$ javac Vertex.java
$ javac DFS.java
DFS.java:6: cannot find symbol
symbol : class Vertex
location: class graph.DFS
public Vertex[] vertex;
^
DFS.java:9: cannot find symbol
symbol : class Vertex
location: class graph.DFS
public PriorityQueue<Vertex> queue = new PriorityQueue<Vertex>();
^
DFS.java:30: cannot find symbol

...


Vertex.java


DFS.java




 
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if Vertex and DFS are classes in the graph package, then they both have to be in a (sub) directory named "graph", and should be compiled from the directory that contains graph.

$ cd /root
$ ls
graph
$ javac graph/Vertex.java
$ javac graph/DFS.java

My unix is quite rusty, but I hope that's enough to give you the idea. Could that be your problem?

rc
 
Marshal
Posts: 79401
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would have thought you start with something like cd java. If you go to /root, you won't usually have write permission.
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, forgot that root was the name of an actual unix directory. I should have used something like "project".

rc
 
Campbell Ritchie
Marshal
Posts: 79401
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And why are you setting a classpath at all?
 
ice is for people that are not already cool. Chill with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic