Cannot Find Symbol Class Java Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads java cannot find symbol class in same package with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the java cannot find symbol class filenotfoundexception Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: java cannot find symbol class list Sign up “Cannot Find Symbol” compile error up vote 4 down vote favorite 1 My coding experience has only gone back a few years, so this question should be easy enough to answer. I have written two interfaces: Class and Game. Interface
Java Cannot Find Symbol Class String
CLASS is supposed to extend interface GAME. Here are the two interface sources: package Impl; public interface Game { //METHODS AND VARS } package Impl; public interface Class extends Game { //METHODS AND VARS } Now, when I try to compile the second interface, I get the following error class.java:4: cannot find symbol symbol: class Game public interface Class extends Game ^ My Game class is compiled and the class file is in the same directory as both java files. I have not java cannot find symbol class t been able to find a solution. Does anyone have any ideas? java compiler-errors share|improve this question edited Oct 11 '10 at 3:21 James McNellis 244k46708846 asked Oct 11 '10 at 3:19 Jay 21112 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote Class names are case sensitive. It is possible that you have created an interface called game, but you refer to it in your Class interface declaration as Game, which the compiler cannot find. However, there is another chance that you are compiling from within your Impl package. To do this, you will need to reference your classpath such that the compiler can find classes from the base of the package structure. You can add a -classpath .. arg to your javac before the class name: javac -classpath .. Class.java Alternatively, you can do what is more common, compiling from the root of your package structure. To do so, you will need to specify the path to your Class file: javac Impl\Class.java you can always add a -classpath . to be clear. share|improve this answer edited Oct 11 '10 at 3:53 answered Oct 11 '10 at 3:42 akf 28.9k65986 Thank you. This solved my problem completely. I had assumed it was a coding problem. –Jay Oct 11 '10 at 3:55 6 Jay, I see you are new at StackOverflow (Welcome!). Please "Accept" akf's solution if it solved your problem. The more answers you have accepted, the more will
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of java cannot find symbol class in same directory this site About Us Learn more about Stack Overflow the company Business Learn
Java Error Cannot Find Symbol Method
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Java Error Cannot Find Symbol Variable
x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “cannot http://stackoverflow.com/questions/3903330/cannot-find-symbol-compile-error find symbol - class Scanner” error up vote 6 down vote favorite 2 This is my Code public class Workshop3 { public static void main (String [] args) { System.out.println ("please enter radius of circle"); double radius; Scanner keyboard = new Scanner (System.in); keyboard.nextDouble (radius); } } The error I recieve is cannot find symbol - class scanner on the line Scanner keyboard http://stackoverflow.com/questions/5959061/cannot-find-symbol-class-scanner-error = new Scanner (System.in); java share|improve this question edited Nov 13 '13 at 15:33 gunr2171 5,689103160 asked May 11 '11 at 3:56 James Blundell 26112 3 If you find any answer useful and does solve your problem then please accept the answer by clicking on the tick mark to the left of the answer.. This helps others who face the same problem and indicates them that this particular answer solved their problem.. –Mahendra May 11 '11 at 4:12 add a comment| 4 Answers 4 active oldest votes up vote 11 down vote As the OP is a new beginner to programming, I would like to explain more. You wil need this line on the top of your code in order to compile: import java.util.Scanner; This kind of import statement is very important. They tell the compile of which kind of Scanner you are about to use, because the Scanner here is undefined by anyone. After a import statement, you can use the class Scanner directly and the compiler will know about it. Also, you can do this without using the import statement, although I don't recommend: java.util.Scanner scanne
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of http://stackoverflow.com/questions/7373173/cannot-find-symbol-for-another-class-file this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up cannot find Cannot Find Symbol for another class file up vote 2 down vote favorite I've had this problem a few times, where I've created another class file and the main class file can't find it. Here's the main class file: package textfiles; import java.io.IOException; public class FileData { public static void main(String[] args) { String file_name = "Lines.txt"; try { ReadFile file = new cannot find symbol ReadFile(file_name); String[] aryLines = file.OpenFile(); for(int i =0; i