Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

java 7: cannot find symbol  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying the very first sample from Java's Programming Language book for course SL-275-SE6 called TestGreeting. Here is the code:

TestGreeting.java

//
// Sample "Hello World" application
//

public class TestGreeting {
public static void main (String[] args) {
Greeting hello = new Greeting();
hello.greet();

}
}

Greeting.java

public class Greeting {
public void greet() {
System.out.println("hi");
}
}

When I go to compile TestGreeting.Java, I get an error message
7: cannot find symbol
symbol : class Greeting
location : class TestGreeting
Greeting hello = new Greeting();

I've tried the HelloWorldApp and it comiles and run
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}


I don't have admin priviliges on my work computer. My jdk is installed on c:/Program Files/Java/jdk1.6.0_06/bin

My work directory is on h:/Java

I've been searching the error and the posts are pointing towards setpath. I've tried different commads but I am still not having any success.

Anyone has encountered this error - How can I resolve it?

Thanks in advance!
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kanwal,

Are those two classes remaining in the same package?
 
Preet Dhillon
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are in the same folder.
 
author
Sheriff
Posts: 23565
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Kanwal Dhatt:
They are in the same folder.



Do you have a classpath assigned? And if you do, is that folder in the classpath?

Henry
 
Anoobkumar Padmanabhan
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But it works fine for me..
without any compilation errors.
 
Preet Dhillon
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a classpath assigned? And if you do, is that folder in the classpath?


I don't think I've been doing it correctly.

I am working on windows and here is what I am doing:

c:\Program Files\Java\jdk1.6.0_06\bin>javac -classpath H:\java\TestGreeting.java


I get the following message:
javac: no source files...


Is the syntax for my set classpath correct?
If I don't have admin priviliges to my computer, Can I still assign classpath?

Thanks!
[ October 30, 2008: Message edited by: Kanwal dhatt ]
 
Preet Dhillon
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Issue resolved

Once set the CLASSPATH correctly by -
c:\> set CLASSPATH=H:\Java\test

I was able to compile and run the prorgam

Thanks!
[ October 31, 2008: Message edited by: Kanwal dhatt ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!