Questions tagged [cannot-find-symbol]

This tag is used when code returns an error message that a symbol cannot be located. These are usually compilation errors in Java.

This tag is used when code returns an error message that a symbol cannot be located. Such messages are usually associated with compilation errors in Java. See this post for a detailed description of causes and solutions: What does a "Cannot find symbol" compilation error mean?

251 questions
-1
votes
1 answer

Cannot find symbol - variable answer

I have made this simple code which adds numbers together and finds the average. I get the error message shown in the title. The code below is; can someone please help me with the error when my tutor couldn't? public class MathsQuiz { public…
Daniel G
  • 47
  • 8
-1
votes
1 answer

Initializing generic Collection

It has been a few years since programming in Java, so I decided to consult an old, reliable source. In "Introduction to Java Programming" by Liang, pg. 798, an ArrayList is scheduled like so: Collection collection = new…
JDQ
  • 443
  • 7
  • 11
-1
votes
1 answer

PasswordVerifier sample won't compile

I'm getting a Java: 10: error for line 7, when I compile the code listed below. This is sample given to us for this weeks assignment to tailor to meet requirements of the project and I know this same code has popped up repeated on Stack. import…
-1
votes
2 answers

JAVA IF ELSE Statement causes error in my code

Part part = request.getPart("file"); if (part != null){ String fileName = extractFileName(part); String filePath = savePath + File.separator + fileName; part.write(savePath + File.separator + fileName); …
-1
votes
1 answer

I'm getting an error - cannot find symbol listOfBooks

I've been looking at this for ages and I cannot figure out why it cannot find listOfBooks. Have I defined it incorrectly in my public class Library? Here's the code: Library.java import java.util.List; import java.util.ArrayList; public class…
Dafzr308
  • 13
  • 6
-1
votes
2 answers

"Cannot find symbol" on servletContext().getRequestDispatcher

protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); HttpSession sesion = request.getSession(); …
jjprz
  • 55
  • 1
  • 2
  • 8
-1
votes
2 answers

Cannot find symbol method - Where should I define my methods?

I'm writing a banking program in Java, and am having some trouble getting a couple of my methods to be called correctly. When I try to compile my files, these are the errors I get: MustangBanking.java:74: error: cannot find symbol …
njwoodard
  • 37
  • 1
  • 5
-1
votes
2 answers

cannot find symbol...?

I have to write code that takes in a string of 3 letters and converts it to give the complement DNA (A==T, C==G AND REVERSE) string. Although I think the code is okay, it keeps giving me the same error "cannot find symbol" At the string dna…
-1
votes
2 answers

getting an error "cannot find symbol" while Capturing the contents of a url and storing it into a string array

I'm learning about servlets in java and I'm trying to capture a URL content and store it into a string array. Bellow is my code that I put together following some tutorials that does not seem to work servlet environment (This is the first part of an…
zamzam
  • 347
  • 1
  • 2
  • 9
-1
votes
1 answer

ImageJ cannot find symbol

So I have no idea why I get a "cannot find symbol error" for img in the following code. This code is based off an ImageJ Plugin template that works perfectly fine, so something must be eluding me... import ij.*; import ij.process.*; …
WIlopu
  • 47
  • 7
-1
votes
3 answers

Cannot find symbol - when calling a method

The purpose of this code is to find the maximum value in a user-inputted 2-dimensional array. The code makes sense but when I try and compile, it gives me to following error: ERROR: LocateLargestElement.java:41: error: cannot find symbol int…
-2
votes
2 answers

Cannot access class in java

I am trying to create a class to send information on the day of the week. For some reason when I try to include the class I get an error saying: CreateCalendarVisuals.java:1: error: cannot access FindDateFindTime import…
KlutzyMender
  • 18
  • 1
  • 3
-2
votes
2 answers

How to solve this cannot find symbol that keeps occurring due to an identifier?

I'm creating this Tic Tac Toe game using java, however, when I try to compile the program I keep getting cannot find symbol error from the Cell class which I am struggling to solve. Reading the cannot find symbol error compilation I've realized that…
kinghabz 14
  • 7
  • 1
  • 2
-2
votes
1 answer

How to fix the "cannot find symbol" error in Java?

I wrote a piece of code that appends the contents of all CSV files into a list. Compiling this program generates a "cannot find symbol" error at the line '''Iterator iter = full_files.iterator();''' I checked my declarations and everything seems to…
-2
votes
3 answers

Stuck with this programming question for school

I'm writing a simple Java program for school. I can't seem to understand why I am getting Error: Cannot Find Symbol . Here's the whole code with the error at the bottom. (Click image to enlarge)