Cannnot Resolve symbol error
I have two small java programs one refferring to another.When I try to complie main program I get following error:
GenericMaintenance.java:12: cannot resolve symbol
symbol : class csvfile
location: package csv
import com.csv.csvfile;
^
1 error
Here csvfile is the child class which i am trying to call from main program
The codes are asfollows:
GenericMaintenance.java:
package com.others;
import java.io.*;
import java.util.StringTokenizer;
import java.sql.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import Util;
import jxl.*;
import com.csv.csvfile;
public class GenericMaintenance
csvfile.java:
package com.csv.csvfile;
import java.io.*;
import java.util.StringTokenizer;
import java.sql.*;
import java.util.*;
import java.text.*;
import jxl.*;
//import Util;
public class csvfile {
I don't see anything wrong with code.Could somebody please advice me ASAP on this.
I have two small java programs one refferring to
another.When I try to complie main program I get
following error:
GenericMaintenance.java:12: cannot resolve symbol
symbol : class csvfile
location: package csv
import com.csv.csvfile;
^
csvfile is the child class which i am trying to call
from main program
The codes are asfollows:
GenericMaintenance.java:
package com.others;
import java.io.*;
import java.util.StringTokenizer;
import java.sql.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import Util;
import jxl.*;
import com.csv.csvfile;
Hey, I think the import is wrong here.. looking at the two classes you hve given in ur description.. <b>csvfile.java</b> belongs to a package called <b>com.csv.csvfile</b>, so you should import this as
import com.csv.csvfile.csvfile;but not
import com.csv.csvfile; // u can't import package like this.. u should use .*
// if u want to import only one class u should write till the class name
public class GenericMaintenance
csvfile.java:
package com.csv.csvfile;
hope it helps..
Similar Messages
-
Cannot resolve symbol error even with class imported
Hi
I'm trying to print out a java.version system property but keep getting a
cannot resolve symbol error
symbol: class getProperty
location: class java.lang.System
I've looked at the API and getProperty() is a method of lang.System
Can anyone throw any light?
thanks
import java.lang.System;
class PropertiesTest {
public static void main(String[] args) {
String v = new System.getProperty("java.version");
System.out.println(v);
}Thanks Jos
It compiles but I now get a runtime error
Exception in thread "main"
java.lang.NoClassDefFoundError:PropertiesTest
What do you reckon is the problem?
thanks
java -cp .;<any other directories or jars>
YourClassNameYou get a NoClassDefFoundError message because the
JVM (Java Virtual Machine) can't find your class. The
way to remedy this is to ensure that your class is
included in the classpath. The example assumes that
you are in the same directory as the class you're
trying to run.I know it's a bad habit but I've put this file (PropertiesTest.java) and the compiled class (PropertiesTest.class) both in my bin folder which contains the javac compiler -
Help.. incompatiable type and cannot resolve symbol error...
I have this class Box
class Box{
private int width;
private int height;
private int depth;
private int BoxCounter;
public void click()
BoxCounter = 0;
}and in my main code, I'm calling it via
private Box arrBox[];All this goes fine until I try to place code in to make array empty upon a selected action by
if (color == blue) {arrBox = new Box();}Here I'm getting the error saying that its an incompatible type... it says I have Box but it requires class Box[]...(the ^ pointing at the word "new")
also, I have this
public void button()
arrBox.click()
}This returns the unable to resolve symbol error (the ^ points at the dot).... I tried changing things around but the problem persists, can someone point out where I hv gone wrong?
Many thanksprivate Box arrBox[];The line above does not create an array, it only declares that the variable arrBox can refernce an array of type Box. Arrays are objects just like Box - you need a new Box[10], for example, to create the array.
if (color == blue) {arrBox = new Box();}
Here I'm getting the error saying that its an
incompatible type... it says I have Box but it
requires class Box[]...(the ^ pointing at the word
"new")As previously stated, arrBox is a reference to an array of Box, not an object instance of Box.
A lot of your trouble can be resolved by understanding how arrays work in java. Try here.
http://java.sun.com/docs/books/tutorial/java/data/arrays.html
You must create an array similar to creating any object. Next, you must create objects to go inside the array. It's difficult without knowing the rest of your code, but here goes.
private Box[] arrBox = new Box[10];
for(int index=0;index<arrBox.length;index++) {
int color = getColor(index); //I'm making this up
if(color == blue) arrBox[index] = new Box();
}The above code will create a new Box for any index where the color is blue. The indices where the color isn't blue are equal to null. -
Cannot find package error and cannot resolve symbol error
Hi
I have a file Assignment.java in C:\TIJCode\c03 folder. But this file belongs to the default package. This file imports a package com.bruceeckel.simpletest which is in C:\TIJCode\ folder. Now this package has a file named Test.java which accesses a few more files fromt he same package.
I set the classpath to C:\TIJCode. When i try to run the Assignment file I get an error saying package com.bruceeckel.simpletest cannot be found and cannot resolve symbol error. symbol: Test Class: Assignment.
The files in com.bruceeckel.simpletest package were not compiled. So I first tried to do that. But I get a cannot resolve symbol error while trying to compile a file NumOfLinesException which inherits SImpleTestException file. The exact error message is
NumOfLinesException.java : 7 : cannot resolve symbol
symbol : class SimpleTestException
location : class com.bruceeckel.simpletest.NumOfLinesException extends SimpleTestException
The exact code in each of above mentioned files is
//: c03:Assignment.java
// Assignment with objects is a bit tricky.
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
import com.bruceeckel.simpletest.*;
class Number {
int i;
public class Assignment {
static Test monitor = new Test();
public static void main(String[] args) {
Number n1 = new Number();
Number n2 = new Number();
n1.i = 9;
n2.i = 47;
System.out.println("1: n1.i: " + n1.i +
", n2.i: " + n2.i);
n1 = n2;
System.out.println("2: n1.i: " + n1.i +
", n2.i: " + n2.i);
n1.i = 27;
System.out.println("3: n1.i: " + n1.i +
", n2.i: " + n2.i);
monitor.expect(new String[] {
"1: n1.i: 9, n2.i: 47",
"2: n1.i: 47, n2.i: 47",
"3: n1.i: 27, n2.i: 27"
} ///:~
//: com:bruceeckel:simpletest:SimpleTestException.java
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
package com.bruceeckel.simpletest;
public class SimpleTestException extends RuntimeException {
public SimpleTestException(String msg) {
super(msg);
} ///:~
//: com:bruceeckel:simpletest:NumOfLinesException.java
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
package com.bruceeckel.simpletest;
public class NumOfLinesException extends SimpleTestException {
public NumOfLinesException(int exp, int out) {
super("Number of lines of output and "
+ "expected output did not match.\n" +
"expected: <" + exp + ">\n" +
"output: <" + out + "> lines)");
} ///:~
//: com:bruceeckel:simpletest:Test.java
// Simple utility for testing program output. Intercepts
// System.out to print both to the console and a buffer.
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
package com.bruceeckel.simpletest;
import java.io.*;
import java.util.*;
import java.util.regex.*;
public class Test {
// Bit-shifted so they can be added together:
public static final int
EXACT = 1 << 0, // Lines must match exactly
AT_LEAST = 1 << 1, // Must be at least these lines
IGNORE_ORDER = 1 << 2, // Ignore line order
WAIT = 1 << 3; // Delay until all lines are output
private String className;
private TestStream testStream;
public Test() {
// Discover the name of the class this
// object was created within:
className =
new Throwable().getStackTrace()[1].getClassName();
testStream = new TestStream(className);
public static List fileToList(String fname) {
ArrayList list = new ArrayList();
try {
BufferedReader in =
new BufferedReader(new FileReader(fname));
try {
String line;
while((line = in.readLine()) != null) {
if(fname.endsWith(".txt"))
list.add(line);
else
list.add(new TestExpression(line));
} finally {
in.close();
} catch (IOException e) {
throw new RuntimeException(e);
return list;
public static List arrayToList(Object[] array) {
List l = new ArrayList();
for(int i = 0; i < array.length; i++) {
if(array[i] instanceof TestExpression) {
TestExpression re = (TestExpression)array;
for(int j = 0; j < re.getNumber(); j++)
l.add(re);
} else {
l.add(new TestExpression(array[i].toString()));
return l;
public void expect(Object[] exp, int flags) {
if((flags & WAIT) != 0)
while(testStream.numOfLines < exp.length) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
List output = fileToList(className + "Output.txt");
if((flags & IGNORE_ORDER) == IGNORE_ORDER)
OutputVerifier.verifyIgnoreOrder(output, exp);
else if((flags & AT_LEAST) == AT_LEAST)
OutputVerifier.verifyAtLeast(output,
arrayToList(exp));
else
OutputVerifier.verify(output, arrayToList(exp));
// Clean up the output file - see c06:Detergent.java
testStream.openOutputFile();
public void expect(Object[] expected) {
expect(expected, EXACT);
public void expect(Object[] expectFirst,
String fname, int flags) {
List expected = fileToList(fname);
for(int i = 0; i < expectFirst.length; i++)
expected.add(i, expectFirst[i]);
expect(expected.toArray(), flags);
public void expect(Object[] expectFirst, String fname) {
expect(expectFirst, fname, EXACT);
public void expect(String fname) {
expect(new Object[] {}, fname, EXACT);
} ///:~What do you have in the C:\TIJCode\ directory? Does the directory structure mimic the package structure for the stuff you're importing?
-
Weird cannot resolve symbol error.
I'm having a problem with the most simple thing, but I really don't know what is th error, maybe I can�t see the error because the lack of rest.
I have two classes, both are in a package and in the same folder.
This is are the problematic lines.
tmpLong = calculateSizeFile("sonido.wav");
tmpInt = calculateSizeSegment("sonido.wav");
SendFile file1 = new SendFile(args[0], "sonido.wav", 2, 32, 2, 2, tmpLong, tmpInt);
The SendFile is the other class and it�s a thread.
The package decalaration is:
package com.sigmatao.gde.batch;
This is the constructor of the other class:
public SendFile(String httpServlet, String file, int numberRetry, int maxTimeWait,int multiplier,int timeMin, long sizeFileToSend, int sizeSegmentFile)
Thanks in advanced for the help.C:\Temp\URL\com\sigmatao\gde\batch>javac BatchTransfer.java
BatchTransfer.java:20: cannot resolve symbol
symbol : class SendFile
location: class com.sigmatao.gde.batch.BatchTransfer
SendFile file1 = new SendFile(args[0], "sonido.wav", 2, 32, 2, 2, tmpLon
g, tmpInt);
^
BatchTransfer.java:20: cannot resolve symbol
symbol : class SendFile
location: class com.sigmatao.gde.batch.BatchTransfer
SendFile file1 = new SendFile(args[0], "sonido.wav", 2, 32, 2, 2, tmpLon
g, tmpInt);
This is the problem. -
HELP PLEASE Cannot resolve symbol error
Only just started to atempt simple java programs and this same error keeps appearing. code i am using is:
import java.io.*;
class Q1
public static void main(String[] args) throws IOException
int num1,num2,sum;
/*program statements start here*/
System.out.printIn ("Input a number");
num1= Course_io.readInt();
System.out.printIn ("Input another number");
num2= Course_io.readInt();
sum= num2 - num1;
System.out.printIn ("Total is" +sum );
and this is the error message i keep getting:
javac -d . -g "C:\Java Programs\Q1.java"
C:\Java Programs\Q1.java:12: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn ("Input a number");
^
C:\Java Programs\Q1.java:16: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn ("Input another number");
^
C:\Java Programs\Q1.java:22: cannot resolve symbol
symbol : method printIn (java.lang.String)
location: class java.io.PrintStream
System.out.printIn ("Total is" +sum );
^
3 errors
Please help me, Thankyou.sum= num2 - num1;
System.out.printIn ("Total is" +sum );While you're at it, do something about this, it's misleading.
kind regards,
Jos -
Cannot resolve symbol error when compiling a class that calls another class
I've read all the other messages that include "cannot resolve symbol", but no luck. I've got a small app - 3 classes all in the same package. BlackjackDAO and Player compile OK, but BlackjackServlet throws the "cannot resolve symbol" (please see pertinent code below)...
I've tried lots: ant and javac compiling, upgrading my version of tomcat, upgrading my version of jdk/jre, making sure my servlet.jar is being seen by the compiler (at least as far as I can see from the -verbose feedback)...any help would be GREAT! Thanks in advance...
classes: BlackjackServlet, BlackjackDAO, Player
package: myblackjackpackage
tomcat version: 4.1.1.8
jdk version: j2sdk 1.4.0
ant version: 1.4.1
I get the same error message from Ant and Javac...
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
compile error:
BlackjackServlet.java:55: cannot resolve symbol
symbol: method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet.http.Http
ServletResponse)
location: class myblackjackpackage.BlackjackServlet
addPlayer(request, response);
^
My code is:
package myblackjackpackage;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.lang.*;
/** controller servlet in a web based blackjack game application @author Ethan Harlow */
public class BlackjackServlet extends HttpServlet {
private BlackjackDAO theBlackjackDAO;
public void init() throws ServletException {
String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433";
String userid = "testlogin";
String passwrd = "testpass";
try {
theBlackjackDAO = new BlackjackDAO(driver, dbUrl, userid, passwrd);
catch (IOException exc) {
System.err.println(exc.toString());
catch (ClassNotFoundException cnf) {
System.err.println(cnf.toString());
catch (SQLException seq) {
System.err.println(seq.toString());
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String command = request.getParameter("command");
if (command == null || (command.equals("stats"))) {
else if (command.equals("add")) {
try {
//the following line is caught by compiler
addPlayer(request, response);
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<p>Hi, your command was " + request.getParameter("command") + "!!!</p>");
out.println("</body>");
out.println("</html>");
catch (Exception exc) {
System.err.println(exc.toString());
else if (command.equals("play")) {
else if (command.equals("bet")) {
else if (command.equals("hit")) {
else if (command.equals("stand")) {
else if (command.equals("split")) {
else if (command.equals("double")) {
else if (command.equals("dealerdecision")) {
else if (command.equals("reinvest")) {
else if (command.equals("changebet")) {
else if (command.equals("deal")) {
package myblackjackpackage;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.lang.*;
public class BlackjackDAO {
private Connection myConn;
public BlackjackDAO(String driver, String dbUrl, String userid, String passwrd)
throws IOException, ClassNotFoundException, SQLException {
System.out.println("Loading driver: " + driver);
Class.forName(driver);
System.out.println("Connection to: " + dbUrl);
myConn = DriverManager.getConnection(dbUrl, userid, passwrd);
System.out.println("Connection successful!");
public void addPlayer(HttpServletRequest request, HttpServletResponse response)
throws IOException, SQLException {
//I've commented out all my code while debugging, so I didn't include
//any here
compiler feedback
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
[parsing started BlackjackDAO.java]
[parsing completed 90ms]
[parsing started BlackjackServlet.java]
[parsing completed 10ms]
[parsing started Player.java]
[parsing completed 10ms]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Object.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/Connection.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/String.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/IOException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/ClassNotFoundException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/SQLException.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletRequ
est.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletResp
onse.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServlet.cla
ss)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/GenericServlet.class
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/Servlet.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletConfig.class)
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Serializable.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletException.cla
ss)]
[checking myblackjackpackage.BlackjackDAO]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Throwable.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Exception.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/System.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/OutputStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Class.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/DriverManager.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/util/Properties.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Error.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/RuntimeException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/StringBuffer.class)]
[wrote BlackjackDAO.class]
[checking myblackjackpackage.BlackjackServlet]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletRequest.class
BlackjackServlet.java:55: cannot resolve symbol
symbol : method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet
.http.HttpServletResponse)
location: class myblackjackpackage.BlackjackServlet
addPlayer(request, response);
^
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletResponse.clas
s)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintWriter.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Writer.class)]
[checking myblackjackpackage.Player]
[total 580ms]
1 error
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>
and here's the ant feedback...
C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
Ant version 1.4.1 compiled on October 11 2001
Buildfile: build.xml
Detected Java version: 1.4 in: c:\j2sdk14003\jre
Detected OS: Windows 2000
parsing buildfile C:\Tomcat4118\src\webapps\helloblackjack\build.xml with URI =
file:C:/Tomcat4118/src/webapps/helloblackjack/build.xml
Project base dir set to: C:\Tomcat4118\src\webapps\helloblackjack
Build sequence for target `all' is [clean, prepare, compile, all]
Complete build sequence is [clean, prepare, compile, all, javadoc, deploy, dist]
clean:
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.g
if
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.g
if
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\im
ages
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\index.html
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.ht
ml
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\clas
ses\myblackjackpackage\BlackjackDAO.class
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF\classes\myblackjackpackage
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF\classes
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.
xml
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
prepare:
[mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build
[copy] images\a_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\images\a_s.gif doesn't exist.
[copy] images\q_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\images\q_s.gif doesn't exist.
[copy] index.html added as C:\Tomcat4118\src\webapps\helloblackjack\build\i
ndex.html doesn't exist.
[copy] newplayer.html added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\newplayer.html doesn't exist.
[copy] WEB-INF\web.xml added as C:\Tomcat4118\src\webapps\helloblackjack\bu
ild\WEB-INF\web.xml doesn't exist.
[copy] omitted as C:\Tomcat4118\src\webapps\helloblackjack\build is up to
date.
[copy] images added as C:\Tomcat4118\src\webapps\helloblackjack\build\image
s doesn't exist.
[copy] WEB-INF added as C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-
INF doesn't exist.
[copy] Copying 5 files to C:\Tomcat4118\src\webapps\helloblackjack\build
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\q_s.gif
to C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.gif
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\a_s.gif
to C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.gif
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\index.html to C
:\Tomcat4118\src\webapps\helloblackjack\build\index.html
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\newplayer.html
to C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.html
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\WEB-INF\web.xml
to C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.xml
compile:
[mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\
classes
[javac] myblackjackpackage\BlackjackDAO.class skipped - don't know how to ha
ndle it
[javac] myblackjackpackage\BlackjackDAO.java added as C:\Tomcat4118\src\weba
pps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackDAO.class d
oesn't exist.
[javac] myblackjackpackage\BlackjackServlet.java added as C:\Tomcat4118\src\
webapps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackServlet
.class doesn't exist.
[javac] myblackjackpackage\Player.java added as C:\Tomcat4118\src\webapps\he
lloblackjack\build\WEB-INF\classes\myblackjackpackage\Player.class doesn't exist
[javac] Compiling 3 source files to C:\Tomcat4118\src\webapps\helloblackjack
\build\WEB-INF\classes
[javac] Using modern compiler
[javac] Compilation args: -d C:\Tomcat4118\src\webapps\helloblackjack\build\
WEB-INF\classes -classpath
"C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-I
NF\classes;
C:\tomcat4118\common\classes;
C:\tomcat4118\common\lib\activation.jar;
C:\tomcat4118\common\lib\ant.jar;
C:\tomcat4118\common\lib\commons-collections.jar;
C:\tomcat4118\common\lib\commons-dbcp.jar;
C:\tomcat4118\common\lib\commons-logging-api.jar;
C:\tomcat4118\common\lib\commons-pool.jar;
C:\tomcat4118\common\lib\jasper-compiler.jar;
C:\tomcat4118\common\lib\jasper-runtime.jar;
C:\tomcat4118\common\lib\jdbc2_0-stdext.jar;
C:\tomcat4118\common\lib\jndi.jar;
C:\tomcat4118\common\lib\jta.jar;
C:\tomcat4118\common\lib\mail.jar;
C:\tomcat4118\common\lib\mysql_uncomp.jar;
C:\tomcat4118\common\lib\naming-common.jar;
C:\tomcat4118\common\lib\naming-factory.jar;
C:\tomcat4118\common\lib\naming-resources.jar;
C:\tomcat4118\common\lib\servlet.jar;
C:\tomcat4118\common\lib\tools.jar;
C:\j2sdk14003\lib\tools.jar;
C:\tomcat4118\ant141\lib\servlet.jar;
C:\tomcat4118\ant141\lib\jaxp.jar;
C:\tomcat4118\ant141\lib\crimson.jar;
C:\tomcat4118\ant141\lib\ant.jar;
C:\Tomcat4118\src\webapps\helloblackjack;
C:\mysql\jdbc_dvr\mm.mysql.jdbc-1.2c;
C:\Program Files\SQLserverjdbcdriver\lib\msbase.jar;
C:\Program Files\SQLserverjdbcdriver\lib\msutil.jar;
C:\Program Files\SQLserverjdbcdriver\lib\mssqlserver.jar"
-sourcepath C:\Tomcat4118\src\webapps\helloblackjack\src -g -O
[javac] Files to be compiled:
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackDAO
.java
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackSer
vlet.java
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Player.java
[javac] C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Blac
kjackServlet.java:55: cannot resolve symbol
[javac] symbol : method addPlayer (javax.servlet.http.HttpServletRequest,j
avax.servlet.http.HttpServletResponse)
[javac] location: class myblackjackpackage.BlackjackServlet
[javac] addPlayer(request, response);
[javac] ^
[javac] 1 error
BUILD FAILED
C:\Tomcat4118\src\webapps\helloblackjack\build.xml:212: Compile failed, messages
should have been provided.
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:559)
at org.apache.tools.ant.Task.perform(Task.java:217)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at org.apache.tools.ant.Project.executeTargets(Project.java:560)
at org.apache.tools.ant.Main.runBuild(Main.java:454)
at org.apache.tools.ant.Main.start(Main.java:153)
at org.apache.tools.ant.Main.main(Main.java:176)
Total time: 1 second
C:\Tomcat4118\src\webapps\helloblackjack>yes!
early on i tried: BlackjackDAO.addPlayer(request, response);
instead of: theBlackjackDAO.addPlayer(request, response);
you rock - thanks a ton -
Cannot resolve symbol error while trying to define methods in a class
Well, I'm fairly new to java and I'm trying to write a simple program that will take user input for up to 100 die and how many sides they have and will then roll them and output the frequencies of numbers occuring. I have overloaded the constructor for the Die class to reflect different choices the user may have when initializing the Die.
Here is my code:import java.util.*;
import java.io.*;
public class Die
private final int MIN_FACES = 4;
private int numFaces;
private int i = 0;
private int faceValue;
private Die currentDie;
private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private String line = null;
public Die()
numFaces = 6;
faceValue = 1;
public Die (int faces)
if (faces < MIN_FACES) {
numFaces = 6;
System.out.println ("Minimum number of faces allowed is 6.");
System.out.println ("Setting faces to 6... . . . . . . . . .");
else
numFaces = faces;
faceValue = 1;
//Returns an array of Die Objects
public Die (int num_die, int faces)
numFaces = faces;
Die[] protoDie = new Die[num_die];
for (i = 0; i <= num_die-1; i++)
Die currentDie = new Die(numFaces);
protoDie = protoDie.initMultiDie(currentDie, i);
public Die (double num_die)
int numberOfDie = (int) num_die;
Die[] protoDie = new Die[numberOfDie];
System.out.print ("Enter the number of sides for die #" + i);
for (i=0; i <= protoDie.length; i++) {
do {
try {
line = br.readLine();
numFaces = Integer.parseInt(line);
catch (NumberFormatException nfe) {
System.out.println ("You must enter an integer.");
System.out.print ("Setting number of dice to 0, please reenter: ");
if (numFaces < 0) {
System.out.println ("The number of sides must be positive.");
numFaces *= -1;
System.out.println ("Number of sides is: " + numFaces);
else
if (numFaces = 0) {
System.out.println ("Zero dice is no fun. =[");
System.out.print ("Please reenter the number of sides: ");
numFaces = 0;
while (numFaces == 0);
Die currentDie = new Die(numFaces);
protoDie[i] = protoDie.initMultiDie(currentDie, i);
i = 0;
public Die[] initMultiDie (Die[] protoDie, Die currentDie, int i)
protoDie[i] = currentDie;
return protoDie;
public Die reInit (int sides)
currentDie.roll();
return currentDie;
public int roll()
faceValue = (int) (Math.random() * numFaces) + 1;
return faceValue;
}When I compile I get 2 errors at lines 42 and 73 saying:
Cannot resolve symbol | symbol: method initMultiDie(Die, int) | location: class Die[] | protoDie[i] = protoDie.initMultiDie(currentDie, i)
I've tried mixing things up with invoking the method, such as including protoDie in the parameter liist, instead of invoking the initMultiDie method thru the protoDie Die[] object. I'm a little confused as to what I can and cannot do with defining arrays of Objects like Die. Thank you for any input you may be able to provide.
~LijeI may as well just replace Die with Dice and allow
Dice to represent a collection of 1 die.. I just like
to cut on bloat and make my programs be as efficient
as possible.Efficiency and avoiding code bloat are good goals, but you don't necessarily achieve it by creating the smallest number of classes. If you have N algorithms in M lines, then you have that many, regardless of whether they're in one class or two. A really long source file can be a worse example of bloat than two source files of half the size -- it can be harder to read, less clear in the design, and thus with more bugs...
The important thing is clarity and a strong design.
The weird thing is, that initMultiDie is
what seems to be throwing up the error, but I don't
see why. Meh, I'm sure I'll figure it out.Refactoring a class to make the design more transparent often helps you figure out bugs. -
JMS "cannot resolve symbol" error
I am a bit new to JMS...
I am trying to compile a sample code available on net to receive message from a queue....
I am using MQSeries JMSAdmin as the JMS provider...
however the code is giving the following compile time error...
MqJmsProp.java:257: cannot resolve symbol
symbol : method createSession (boolean,int)
location: interface javax.jms.Connection
QueueSession session = connection.createSession(transacted,Sessi
on.AUTO_ACKNOWLEDGE);
^
1 error
Can anyone suggest me what might be the problem...
Thanks in advance...
PatsHi Shanu...
Thanks for all the interest that you have shown....
I have IBM MWebSphere MQSeries installed on my system...
and as I mentioned earlier am using the JMS implementation provided by MQSeries...
I have created a queue in the queue manager which is on the local system....
I have done JNDI binding for the queue manager and the queue that i m gonna use....
how ever if u look at the error ... it does not say any thing about the queue not available....
its more a pure java related error which i am not able to track.... :(
i know this error looks silly and very novice ... but thats the situation i m in right now...
the code which is giving me this error is like this ....
QueueSession session;
session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
where connection is a javax.jms.QueueConnection object...
I hope this explains my problem in a much better way...
would appreciate if u can throw any light on this...
Thanks,
Pats... -
"cannot resolve symbol" error...please help
when itry to compile my program i get the error " cannot resolve
symbol" variable setLayout.
My program is very small. Can someone tell me why i keep
getting error?
thanx
trin.
import java.applet.*;
import java.awt.*;
public class MyProg extends Applet
Button btnOne = new Button("One");
Button btnTwo = new Button("Two");
public void init()
Panel pOne = new Panel( ) ;
pOne.setLayout = ( new GridLayout( ));
pOne.add(btnOne);
pOne.add(btnTwo);
add(pOne);Change:
pOne.setLayout = ( new GridLayout( ));to
pOne.setLayout( new GridLayout());It's a method call, not an assignment :) -
Please?!? Cannot Resolve Symbol Error Message
//Elizabeth Skelton Section 001 Homework Set 3
import javax.swing.JOptionPane;
public class skeltonMaxofThree
public static void main (String[] args)
//ask user for numbers
String stringnum1= JOptionPane.showInputDialog(null, "Please enter first number", "Input", JOptionPane.QUESTION_MESSAGE);
String stringnum2=JOptionPane.showInputDialog(null, "Please enter second number", "Input", JOptionPane.QUESTION_MESSAGE);
String stringnum3=JOptionPane.showInputDialog(null, "Please enter third number", "Input", JOptionPane.QUESTION_MESSAGE);
//convert to numerical
double num1=Double.parseDouble(stringnum1);
double num2=Double.parseDouble(stringnum2);
double num3=Double.parseDouble(stringnum3);
//call max method
double biggest=maximum(num1,num2,num3);
//display answer
String output = "The biggest is " + biggest;
JOptionPane.showMessageDialog(null, output, "Result", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
public static double maximum(double num1, double num2, double num3)
//determine biggest
double biggest=Math.max(num1,num2,num3);
return biggest;
Returns error:
:\My Documents\BD120\skeltonMaxofThree.java:36: cannot resolve symbol
symbol : method max (double,double,double)
location: class java.lang.Math
double biggest=Math.max(num1,num2,num3);
^
1 error
Tool completed with exit code 1the max method of the Math class requires 2 parameters not 3...to find the maximum of 3 numbers u can do something like this...
double biggest = Math.max(num1, Math.max(num2, num3)); -
Another DiveLog can't resolve symbol error
I am using NetBeans to go through the DiveLog tutorial, which I have first typed, then cut/pasted in (hence I've not included it here). On compilation I get the following error:
divelog/DiveLog.java [41:1] cannot resolve symbol
symbol : method addTab (java.lang.String,<nulltype>,divelog.Welcome,java.lang.String)
location: class javax.swing.JTabbedPane
tabbedPane.addTab("Welcome",
^
1 error
Errors compiling divelog (->).
The rest of the line looks like this:
tabbedPane.addTab("Welcome",
null,
new Welcome(),
"Welcome to the Dive Log");
(Note that I have cut out all the other tabs, just to focus the mind)
As I am sure you expect if I set the component parameter to null (rather than new Welcome()) it compiles just fine.
I have read the troubleshooting tips on the tutorial, and understand that I am not compiling the whole package, but as far as I know I am! I highlight the package and compile all, I have compiled the project, and both with the same result. I have also read many, many newsgroup entries on the same subject and I have been trying all the various solutions for the last two days.
I note that whilst the others have an error that points to Welcome, the error message I get is on the symbol addTab.
I get the same error if I javac it too. (from the Divelog directory I typed javac -classpath d:\java\myjava\ DiveLog.java, and also tried setting a CLASSPATH environmental variable)
I have my path (environmental variable) set to: d:\java\j2sdk_nb\j2sdk1.4.2\bin
I have also set CLASSPATH to d:\java\myJava
Please remember the pain of newbie!
Thanks, Myles
PS I am working in Windows XPThe compiler is saying that in the JTabbedPane class, there is no method that takes a String, a null, a divelog.Welcome, and another String as parameters. I am guessing that in the divelog.Welcome class source code, you are missing something like the bolded text below.
public class Welcome extends JPanel
I'm making this guess because the JTabbedPane needs a Component for the third argument. If you still can't make sense of this, post the page of the tutorial so we can look at it. -
'Cannot Resolve Symbol' error when importing custom class
I get this error...
c:\mydocu~1\n307\auto.java:14: cannot resolve symbol
symbol: class Box
import Box;
^
when I try to compile auto.java, the applet that's supposed to import the class Box, which I built to be like a message box in VB. Here is the code for Box...
import java.awt.*;
import java.awt.event.*;
public class Box extends Window{
Label lblMsg = new Label();
Button cmdOk = new Button("OK");
Panel pnlSouth = new Panel();
EventHandler ehdlr=new EventHandler(this);
public Box(Frame parent){
super(parent);
setLayout(new BorderLayout());
add(lblMsg, BorderLayout.NORTH);
add(pnlSouth, BorderLayout.SOUTH);
pnlSouth.setLayout(new FlowLayout());
pnlSouth.add(cmdOk);
cmdOk.addActionListener(ehdlr);
this.addWindowListener(ehdlr);
public void speak(String msg){
lblMsg.setText(msg);
this.setLocation(200,200);
this.setSize(200,200);
this.setVisible(true);
private class EventHandler extends WindowAdapter
implements ActionListener{
Window theWindow;
public EventHandler(Window a){
theWindow=a;
public void actionPerformed(ActionEvent e){
theWindow.setVisible(false);
AND HERE IS THE CODE FOR AUTO...
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;
import Box;
public class auto extends Applet implements ActionListener{
Panel pnlCenter=new Panel();
Panel pnlSouth=new Panel();
Panel pnlNorth=new Panel();
Panel pnlCenterleft=new Panel();
Panel pnlCenterright=new Panel();
Button cmdSubmit=new Button("Submit");
Button cmdNext=new Button("Next");
Button cmdPrev=new Button("Previous");
Label lblLoc=new Label("LOCATION:");
Label lblDate=new Label("DATE:");
Label lblMile=new Label("MILEAGE:");
Label lblCost=new Label("COST:");
Label lblDesc=new Label("DESCRIPTION:");
Label lblFind=new Label("FIND LOCATION:");
Label lblDisp=new Label();
TextField txtLoc=new TextField();
TextField txtDate=new TextField();
TextField txtMile=new TextField();
TextField txtCost=new TextField();
TextArea txtDesc=new TextArea();
TextField txtFind=new TextField();
Box bxOne = new Box((Frame(this).getParent()));
/*by declaring these four variables here, they are instance level, meaning they are
available to the whole applet*/
String textFile="auto.txt";
String list[] = new String[100];
String sort[] = new String[100];
int counter=0;
int count=0;
String currentLine="";
int i;
int sortcount;
public void init(){
this.setLayout(new BorderLayout());
this.add(pnlNorth, BorderLayout.NORTH);
this.add(pnlCenter, BorderLayout.CENTER);
this.add(pnlSouth, BorderLayout.SOUTH);
pnlNorth.setLayout(new FlowLayout());
pnlNorth.add(new Label("VIEW RECORDS"));
pnlCenter.setLayout(new GridLayout(1,2));
pnlCenter.add(pnlCenterleft);
pnlCenter.add(pnlCenterright);
pnlCenterleft.setLayout(new GridLayout(0,1));
pnlCenterleft.add(lblLoc);
pnlCenterleft.add(lblDate);
pnlCenterleft.add(lblMile);
pnlCenterleft.add(lblCost);
pnlCenterleft.add(lblDesc);
pnlCenterleft.add(lblFind);
pnlCenterright.setLayout(new GridLayout(0,1));
pnlCenterright.add(txtLoc);
pnlCenterright.add(txtDate);
pnlCenterright.add(txtMile);
pnlCenterright.add(txtCost);
pnlCenterright.add(txtDesc);
pnlCenterright.add(txtFind);
pnlSouth.setLayout(new FlowLayout());
pnlSouth.add(cmdPrev);
pnlSouth.add(lblDisp);
pnlSouth.add(cmdSubmit);
pnlSouth.add(cmdNext);
lblDisp.setText("0 of 0");
cmdPrev.addActionListener(this);
cmdNext.addActionListener(this);
cmdSubmit.addActionListener(this);
public void actionPerformed(ActionEvent e){
String command=e.getActionCommand();
if (command.equals("Next")){
if(txtLoc.getText().equals("")){
reader();
transfer();
writer();
bxOne.speak("Viewing all records");
}else{
if(counter<count-2){
counter++;
writer();
}else{
//don't move
} else if (command.equals("Previous")){
if(txtLoc.getText().equals("")){
//do nothing
}else{
if(counter>0){
counter--;
writer();
}else{
//don't move
} else {
txtLoc.setText("");
txtDate.setText("");
txtMile.setText("");
txtCost.setText("");
txtDesc.setText("");
reader();
sorter();
writer();
private void writer(){
StringTokenizer stCurrent=new StringTokenizer(sort[counter], "\t");
txtLoc.setText(stCurrent.nextToken());
txtDate.setText(stCurrent.nextToken());
txtMile.setText(stCurrent.nextToken());
txtCost.setText(stCurrent.nextToken());
txtDesc.setText(stCurrent.nextToken());
lblDisp.setText(String.valueOf(counter+1) + " of " + String.valueOf(count-1));
private void reader(){
try{
URL textURL=new URL(getDocumentBase(), textFile);
InputStream issIn=textURL.openStream();
InputStreamReader isrIn=new InputStreamReader(issIn);
BufferedReader brIn=new BufferedReader(isrIn);
while(currentLine!=null){
currentLine=brIn.readLine();
list[count]=currentLine;
count++;
}catch(MalformedURLException exc){
System.out.println("MalformedURLException Error");
}catch(IOException exc){
System.out.println("IOException Error");
}catch(NullPointerException exc){
System.out.println("NullPointerException Error");
private void transfer(){
for(i=0;i<count;i++){
sort=list[i];
private void sorter(){
sortcount=0;
String find=txtFind.getText();
System.out.println(String.valueOf(count));
for(i=0;i<count-1;i++){
StringTokenizer st=new StringTokenizer(list[i], "\t");
String next=st.nextToken();
if (find.equals(next)){
sort[sortcount]=list[i];
sortcount++;
count=sortcount+1;
Any help is greatly appreciated.
2Willis4Hi agian,
I looked closer at your code, I think if you play around with directories and paths, you'll get it, and I think also when you import, you have to have put the class in a package...? Maybe? Blind leading the blind here! So at the top of your box class you have to say something like
package org.blah.lala
and you have to have that directory structure for the class files org/blah/lala/Box.class
Does that make sense?
And then when you import you say:
import org.blah.lala.Box
(I think)
I cna only imagine that this 'help' I am giving you would be hilarious to a more experienced programmer!
Anyway, best of luck. -
"Cannot resolve symbol" error when importing a package
I'm new to Java and have been trying to make use of a toolikt which uses an imported package. Basically my problem is that I've been trying to compile a file called CookBook.java which contains the following import statements at the top of the file:
package gate;
import java.util.*;
import java.net.*;
import java.io.*;
import junit.framework.*;
import gate.*;
import gate.util.*;
import gate.creole.*;
import gate.creole.nerc.*;
I then compile this using the following command line:
/cygdrive/c/jdk1.3.1_01/bin/javac.exe \
-classpath "C:\cygwin\home\stevens1\gate_src\gate\build\gate.jar" \
-extdirs "C:\cygwin\home\stevens1\gate_src\gate\lib\ext" \
-d . CookBook.java
(The extdirs command is required, acording to the manual, because the toolkit is implemented as two files for security reasons: gate.jar and guk.jar) These two flags should point to all the .jar files required by the application.
However, that command produces the following errors:
CookBook.java:140: cannot resolve symbol
symbol : method assertTrue (java.lang.String,boolean)
location: class gate.CookBook
assertTrue(
^
CookBook.java:146: cannot resolve symbol
symbol : variable GateConstants
location: class gate.CookBook
GateConstants.ORIGINAL_MARKUPS_ANNOT_SET_NAME);
^
CookBook.java:152: cannot resolve symbol
symbol : method assertTrue (java.lang.String,boolean)
location: class gate.CookBook
assertTrue(
^
One thing I've not been clear on is whether the files (CookBook.java) need to be in a directory with a special name. I've tried playing about with different ones but without much success.
Any suggestions to help a completely confused Java rookie would really be apreciated!
thanks in advance
markI then compile this using the following command line:
/cygdrive/c/jdk1.3.1_01/bin/javac.exe \
-classpath "C:\cygwin\home\stevens\gate_src\gate\build\gate.jar" \
-extdirs "C:\cygwin\home\stevens1\gate_src\gate\lib\ext" \
-d . CookBook.javaThere are a couple of issues with your compile...
Most notably, by setting the classpath to your build jar, you are compiling against old classes. If you set your classpath rather to the base of your package hierarchy, then javac will to some degree review and recompile dependencies, against your current source files. If you specify a target directory with -d, class files will be examined in this location if they aren't in the class path (And their source file is not in the compile-path)
Also, if you are compiling packages, I've found a good practice to be to compile from the base of the package structure, so your command will be more likejavac \
-classpath . \
-extdirs "C:\cygwin\home\stevens1\gate_src\gate\lib\ext" \
gate\\CookBook.javaIt seems to make it easier for the compiler to 'correctly' look up dependencies.
Hope that helps, at least a little,
-Troy -
Java Bean Error in JSP: Cannot Resolve Symbol Error
I have created a java bean with following package statement
package mybeans;
and my bean name is
FirstBean
it compile secessfully and now my directory structure is following
WebAppRootDir \ WEB-INF \ classes \ mybeans \ FirstBean.class
I am using Tomcat 4.1 and in JSP i am declaring the bean with following line
<jsp:useBean id="b" class="mybeans.FirstBean" />
and tomcat 4.1 is failed to find this bean and giving me following error
cannot resolve symbol
symbol : class FirstBean
location: package mybeans
mybeans.FirstBean b = null;
all my class and directory structure is ok i am puzzle why this error is coming, plz help me quickly i need solution quickly ...It seem to be ok... why dont your try with a newer versi�n of Tomcat?
Maybe you are looking for
-
How to set the color for road map steps
hi all, my requirement is like ,whenever i select my step in a roadmap it has to be set in yellow color and others has to be in default color. thanks, Siva.
-
Dynamic Scrolling of MovieClip
Hi everyone, I have an application in which i am making a dynamic photo gallery. I have made a scroller movieClip "thumbs_mc". Now i want to make it scroll. for that i created 2 movieClips ,left and right. and wrote some code. but its not working. 1s
-
i recently bought a used ipad with apps from someone. I want to down load my apps on to it with out lossing her apps. how can this be done?
-
How to calculate the COGM for ETO
Hi Gurus, In my client follows Discrete Manufacturing ETO (Engineering to Order), Some Orders showed std price for COGM In some Orders it showed planned Price for COGM In some Orders it showed Other Value for COGM. Still i am confusing regarding fo
-
LSMW - RMDATIND - You have not fully maintained the tax classifications
Hi, I am trying to extend existing materials to new sales organization through LSMW and direct input. I have only one file containing a "header" for the material general data, and "line items" to manage material taxes for other countries than the one