Error compiling EJB.jar + cannot resolve symbol+while deploying
I am getting following
Error compiling EJB.jar , cannot resolve symbol ,Syntax error in source, am getting around 17 errors while deploying EAR generated using Jdev905 into standalone oc4jContainers(10g).
Can anyone please help me out where is the problem.
Regards,
Anup
cannot resolve symbol ,Syntax error in source
indicates some jar file is not in the Classpath. Is j2ee.jar in the Classpath?
Similar Messages
-
Import javax.ejb.EJBHome; cannot resolve symbol
Hi i wonder if anyone can help me. I have read alot of the posts regarding this issue and have tried everything to do with the paths and environmental variables and even reinstalled everything.
import javax.ejb.EJBHome; cannot resolve symbol
This is the problem i keep getting and here are the paths that i set:
SET PATH=c:\j2sdkee1.3\bin;c:\jdk1.3.1_01\bin;c:\jakarta-ant-1.3\bin
SET ANT_HOME=c:\jakarta-ant-1.3
SET JAVA_HOME=c:\jdk1.3.1_01
SET J2EE_HOME=c:\j2sdkee1.3
SET CLASSPATH=c:\j2sdkee1.3\lib\j2ee.jar;c:\jakarta-ant-1.3\lib\ant.jar;c:\jdk1.3.1_01\lib\tools.jar
What am i doing wrong???Im not sure, everything looks ok to me, but here is what i tried:
I wrote this little test class, and compiled it
import javax.ejb.EJBHome;
public class test
public test()
I got the same error you did (or similar)
D:\>javac test.java
test.java:1: package javax.ejb does not exist
import javax.ejb.EJBHome;
^
1 error
then I added the j2ee.jar to my classpath and everything worked fine.
here are my env vars:
JAVA_HOME=d:\dev\jdk
J2EE_HOME=d:\dev\j2sdkee
CLASSPATH=...;%J2EE_HOME%\lib\j2ee.jar
If I were you I would double check all the paths you have set up then try a simple case like the one above. If your running NT/2000 make sure the JAVA_HOME, J2EE_HOME and CLASSPATH are system variables not user variables. Another thing you can try is adding the j2ee.jar to the classpath with the -classpath compiler switch.
javac -classpath %CLASSPATH%;d:\dev\j2sdkee\lib\j2ee.jar test.java
Other than those things I'm not sure
Good Luck -
Error compiling ejb-jar.xml. Help!!
I do not know why this xml file is giving me the errors displayed below.
Thank you in advance.
Here is my xml file:
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN' 'http://www.java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>ObjectConnectorBean</ejb-name>
<display-name>ObjectConnector</display-name>
<home>com.harris.netboss.shared.posting.ObjectConnectorHome</home>
<remote>com.harris.netboss.shared.posting.ObjectConnector</remote>
<ejb-class>com.harris.netboss.shared.posting.ObjectConnectorBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>com.harris.netboss.shared.posting.ObjectConnectorPK</prim-ke
y-class>
<reentrant>False</reentrant>
</entity>
</enterprise-beans>
</ejb-jar>
Here is the error message:
org.xml.sax.SAXParseException: The content of element type "entity" must
match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at org.xml.sax.SAXException.<init>(SAXException.java:45)
at org.xml.sax.SAXParseException.<init>(SAXParseException.java:56)
at
weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1008)
at
weblogic.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLEr
ror(XMLValidator.java:1280)
at
weblogic.apache.xerces.validators.common.XMLValidator.callEndElement(Compile
d Code)
at
weblogic.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispat
ch(Compiled Code)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(Compiled
Code)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
at weblogic.xml.process.ProcessorDriver.process(ProcessorDriver.java:128)
at
weblogic.ejb20.dd.xml.EjbJarLoader_EJB20.process(EjbJarLoader_EJB20.java:919
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:74)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:47)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:38)
at weblogic.ejbc20.runBody(Compiled Code)
at weblogic.utils.compiler.Tool.run(Tool.java:81)
at weblogic.ejbc.main(ejbc.java:20)
--------------- nested within: ------------------
weblogic.xml.process.XMLParsingException: The content of element type
"entity" must match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
. - with nested exception:
[org.xml.sax.SAXParseException: The content of element type "entity" must
match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
.] Line: 16 Column: 16
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at weblogic.utils.NestedException.<init>(NestedException.java:18)
at
weblogic.xml.process.XMLParsingException.<init>(XMLParsingException.java:17)
at weblogic.xml.process.ProcessorDriver.process(ProcessorDriver.java:132)
at
weblogic.ejb20.dd.xml.EjbJarLoader_EJB20.process(EjbJarLoader_EJB20.java:919
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:74)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:47)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:38)
at weblogic.ejbc20.runBody(Compiled Code)
at weblogic.utils.compiler.Tool.run(Tool.java:81)
at weblogic.ejbc.main(ejbc.java:20)
ERROR: weblogic.xml.process.XMLParsingException: The content of element type
"entity" must match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
. - with nested exception:
[org.xml.sax.SAXParseException: The content of element type "entity" must
match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
.] Line: 16 Column: 16looks like your xml file(ejb-jar.xml) is missing some required tag element or
the elements are out of
order. the format is specified in a dtd, you should take a look at the dtd for
ejb-jar.xml. for wl5.1, try looking under c:\weblogic for ejb-jar.dtd
Richard Ong wrote:
I do not know why this xml file is giving me the errors displayed below.
Thank you in advance.
Here is my xml file:
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN' 'http://www.java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>ObjectConnectorBean</ejb-name>
<display-name>ObjectConnector</display-name>
<home>com.harris.netboss.shared.posting.ObjectConnectorHome</home>
<remote>com.harris.netboss.shared.posting.ObjectConnector</remote>
<ejb-class>com.harris.netboss.shared.posting.ObjectConnectorBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>com.harris.netboss.shared.posting.ObjectConnectorPK</prim-ke
y-class>
<reentrant>False</reentrant>
</entity>
</enterprise-beans>
</ejb-jar>
Here is the error message:
org.xml.sax.SAXParseException: The content of element type "entity" must
match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at org.xml.sax.SAXException.<init>(SAXException.java:45)
at org.xml.sax.SAXParseException.<init>(SAXParseException.java:56)
at
weblogic.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1008)
at
weblogic.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLEr
ror(XMLValidator.java:1280)
at
weblogic.apache.xerces.validators.common.XMLValidator.callEndElement(Compile
d Code)
at
weblogic.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispat
ch(Compiled Code)
at weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(Compiled
Code)
at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
at weblogic.xml.process.ProcessorDriver.process(ProcessorDriver.java:128)
at
weblogic.ejb20.dd.xml.EjbJarLoader_EJB20.process(EjbJarLoader_EJB20.java:919
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:74)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:47)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:38)
at weblogic.ejbc20.runBody(Compiled Code)
at weblogic.utils.compiler.Tool.run(Tool.java:81)
at weblogic.ejbc.main(ejbc.java:20)
--------------- nested within: ------------------
weblogic.xml.process.XMLParsingException: The content of element type
"entity" must match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
. - with nested exception:
[org.xml.sax.SAXParseException: The content of element type "entity" must
match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
.] Line: 16 Column: 16
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at weblogic.utils.NestedException.<init>(NestedException.java:18)
at
weblogic.xml.process.XMLParsingException.<init>(XMLParsingException.java:17)
at weblogic.xml.process.ProcessorDriver.process(ProcessorDriver.java:132)
at
weblogic.ejb20.dd.xml.EjbJarLoader_EJB20.process(EjbJarLoader_EJB20.java:919
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:74)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:47)
at weblogic.ejb20.dd.xml.DDUtils.loadDeploymentDescriptor(DDUtils.java:38)
at weblogic.ejbc20.runBody(Compiled Code)
at weblogic.utils.compiler.Tool.run(Tool.java:81)
at weblogic.ejbc.main(ejbc.java:20)
ERROR: weblogic.xml.process.XMLParsingException: The content of element type
"entity" must match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
. - with nested exception:
[org.xml.sax.SAXParseException: The content of element type "entity" must
match
"(description?,display-name?,small-icon?,large-icon?,ejb-name,home,remote,ej
b-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-sche
ma-name?,cmp-field*,primkey-field?,transaction-scope?,env-entry*,ejb-ref*,se
curity-role-ref*,security-identity?,resource-ref*,resource-env-ref*,query*)"
.] Line: 16 Column: 16 -
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 -
Getting error message Cannot Resolve Symbol when trying to compile a class
Hello All -
I am getting an error message cannot resolve symbol while trying to compile a java class that calls another java class in the same package. The called class compiles fine, but the calling class generates
the following error message:
D:\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\cal>javac
ConnectionPool.java
ConnectionPool.java:158: cannot resolve symbol
symbol : class PooledConnection
location: class cal.ConnectionPool
private void addConnection(PooledConnection value) {
^
ConnectionPool.java:144: cannot resolve symbol
symbol : class PooledConnection
location: class cal.ConnectionPool
PooledConnection pcon = new PooledConnection(con);
^
ConnectionPool.java:144: cannot resolve symbol
symbol : class PooledConnection
location: class cal.ConnectionPool
PooledConnection pcon = new PooledConnection(con);
The code is listed as follows for PooledConnection.java (it compiles fine)
package cal;
import java.sql.*;
public class PooledConnection {
// Real JDBC Connection
private Connection connection = null;
// boolean flag used to determine if connection is in use
private boolean inuse = false;
// Constructor that takes the passed in JDBC Connection
// and stores it in the connection attribute.
public PooledConnection(Connection value) {
if ( value != null ) {
connection = value;
// Returns a reference to the JDBC Connection
public Connection getConnection() {
// get the JDBC Connection
return connection;
// Set the status of the PooledConnection.
public void setInUse(boolean value) {
inuse = value;
// Returns the current status of the PooledConnection.
public boolean inUse() {
return inuse;
// Close the real JDBC Connection
public void close() {
try {
connection.close();
catch (SQLException sqle) {
System.err.println(sqle.getMessage());
Now the code for ConnectionPool.java class that gives the cannot
resolve symbol error
package cal;
import java.sql.*;
import java.util.*;
public class ConnectionPool {
// JDBC Driver Name
private String driver = null;
// URL of database
private String url = null;
// Initial number of connections.
private int size = 0;
// Username
private String username = new String("");
// Password
private String password = new String("");
// Vector of JDBC Connections
private Vector pool = null;
public ConnectionPool() {
// Set the value of the JDBC Driver
public void setDriver(String value) {
if ( value != null ) {
driver = value;
// Get the value of the JDBC Driver
public String getDriver() {
return driver;
// Set the URL Pointing to the Datasource
public void setURL(String value ) {
if ( value != null ) {
url = value;
// Get the URL Pointing to the Datasource
public String getURL() {
return url;
// Set the initial number of connections
public void setSize(int value) {
if ( value > 1 ) {
size = value;
// Get the initial number of connections
public int getSize() {
return size;
// Set the username
public void setUsername(String value) {
if ( value != null ) {
username = value;
// Get the username
public String getUserName() {
return username;
// Set the password
public void setPassword(String value) {
if ( value != null ) {
password = value;
// Get the password
public String getPassword() {
return password;
// Creates and returns a connection
private Connection createConnection() throws Exception {
Connection con = null;
// Create a Connection
con = DriverManager.getConnection(url,
username, password);
return con;
// Initialize the pool
public synchronized void initializePool() throws Exception {
// Check our initial values
if ( driver == null ) {
throw new Exception("No Driver Name Specified!");
if ( url == null ) {
throw new Exception("No URL Specified!");
if ( size < 1 ) {
throw new Exception("Pool size is less than 1!");
// Create the Connections
try {
// Load the Driver class file
Class.forName(driver);
// Create Connections based on the size member
for ( int x = 0; x < size; x++ ) {
Connection con = createConnection();
if ( con != null ) {
// Create a PooledConnection to encapsulate the
// real JDBC Connection
PooledConnection pcon = new PooledConnection(con);
// Add the Connection to the pool.
addConnection(pcon);
catch (Exception e) {
System.err.println(e.getMessage());
throw new Exception(e.getMessage());
// Adds the PooledConnection to the pool
private void addConnection(PooledConnection value) {
// If the pool is null, create a new vector
// with the initial size of "size"
if ( pool == null ) {
pool = new Vector(size);
// Add the PooledConnection Object to the vector
pool.addElement(value);
public synchronized void releaseConnection(Connection con) {
// find the PooledConnection Object
for ( int x = 0; x < pool.size(); x++ ) {
PooledConnection pcon =
(PooledConnection)pool.elementAt(x);
// Check for correct Connection
if ( pcon.getConnection() == con ) {
System.err.println("Releasing Connection " + x);
// Set its inuse attribute to false, which
// releases it for use
pcon.setInUse(false);
break;
// Find an available connection
public synchronized Connection getConnection()
throws Exception {
PooledConnection pcon = null;
// find a connection not in use
for ( int x = 0; x < pool.size(); x++ ) {
pcon = (PooledConnection)pool.elementAt(x);
// Check to see if the Connection is in use
if ( pcon.inUse() == false ) {
// Mark it as in use
pcon.setInUse(true);
// return the JDBC Connection stored in the
// PooledConnection object
return pcon.getConnection();
// Could not find a free connection,
// create and add a new one
try {
// Create a new JDBC Connection
Connection con = createConnection();
// Create a new PooledConnection, passing it the JDBC
// Connection
pcon = new PooledConnection(con);
// Mark the connection as in use
pcon.setInUse(true);
// Add the new PooledConnection object to the pool
pool.addElement(pcon);
catch (Exception e) {
System.err.println(e.getMessage());
throw new Exception(e.getMessage());
// return the new Connection
return pcon.getConnection();
// When shutting down the pool, you need to first empty it.
public synchronized void emptyPool() {
// Iterate over the entire pool closing the
// JDBC Connections.
for ( int x = 0; x < pool.size(); x++ ) {
System.err.println("Closing JDBC Connection " + x);
PooledConnection pcon =
(PooledConnection)pool.elementAt(x);
// If the PooledConnection is not in use, close it
if ( pcon.inUse() == false ) {
pcon.close();
else {
// If it is still in use, sleep for 30 seconds and
// force close.
try {
java.lang.Thread.sleep(30000);
pcon.close();
catch (InterruptedException ie) {
System.err.println(ie.getMessage());
I am using Sun JDK Version 1.3.0_02" and Apache/Tomcat 4.0. Both the calling and the called class are in the same directory.
Any help would be greatly appreciated.
tnx..
addiIs ConnectionPool in this "cal" package as well as PooledConnection? From the directory you are compiling from it appears that it is. If it is, then you are compiling it incorrectly. To compile ConnectionPool (and PooledConnection similarly), you must change the current directory to the one that contains cal and type
javac cal/ConnectionPool. -
"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 -
Error when activating - "cannot resolve symbol"
Hi everybody!
I created a WebDynpro DC referencing some other DC's, one of them containing some generated Enterprise Connector classes.
A local build works fine, the WebDynpro looks and works as expected when deployed to our J2EE server. When I activate the associated activities, all DC except the WebDynpro DC compile o.k., but the WebDynpro compilation throws some "cannot resolve symbol" errors, the symbols being the generated classes from the Enterprise Connector DC.
The Activation Log of this component shows that only one class of this DC is being compiled and packed into the public parts of the DC:
[echo] Starting Java compiler
[javac] Compiling 1 source file to /usr/sap/...somewhere.../classes
[timer] Java compilation finished in 0.375 seconds
[echo] Start XLF conversion
[timer] XLF conversion finished in 0.001 seconds
createPublicParts:
[pppacker] Packing assembly public part 'mvRFCAss'
[pppacker] Packed 0 files for entity mvRFCObjects.util (Java Package/Class, mvRFCObjects/util)
[pppacker] Packed 2 files for entity mvRFCObjects (Java Package/Class, mvRFCObjects)
[pppacker] Packed 2 entities for assembly public part 'mvRFCAss'
[timer] Packing of assembly public part 'mvRFCAss' finished in 0.059 seconds
[pppacker] Packing compilation public part 'mvRFCComp'
[pppacker] Packed 0 files for entity GeschaeftsPartnerRFC_PortType (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Z_Ecm_Input (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Z_Ecm_Output (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Ztgd_EcmType (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Ztgd_EcmType_List (Java Class/Class, mvRFCObjects/util)
[pppacker] Packed 2 files for entity MVTestSapAccess (Java Class/Class, mvRFCObjects)
[pppacker] Packed 6 entities for compilation public part 'mvRFCComp'
[timer] Packing of compilation public part 'mvRFCComp' finished in 0.095 seconds
Any hint on what produces such an error or what information you'd need so say something ?
Thanks!After messing around a bit, we finally deleted both assembly and compilation public parts of all the referenced DC's, created new ones and reestablished the references exactly as defined previously, and now it works properly. Strange thing, though...
-
"cannot resolve symbol" error when using super.paintComponent
I am trying to override the paintComponent method in a class extending a JFrame, but when I call super.paintComponent(g) from inside the overridden method I get the error
QubicGUI.java:63: cannot resolve symbol
symbol : method paintComponent (java.awt.Graphics)
location: class javax.swing.JFrame
super.paintComponent(g);
^
1 error
I can't see where I am deviating from examples I know work. It is a very small program, so I have included it here:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.IOException;
import javax.imageio.ImageIO;
import java.net.URL;
class QubicGUI extends JFrame
private int width;
private int height;
private Image background;
public int getWidth()
{ return width; }
public int getHeight()
{ return height; }
public boolean isOpaque()
return true;
public QubicGUI()
super("Qubic"); //set title
// The following gets the default screen device for the purpose of finding the
// current settings of height and width of the screen
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = environment.getDefaultScreenDevice();
DisplayMode display = device.getDisplayMode();
width = display.getWidth();
height = display.getHeight();
// Here we set the window to cover the entire screen with a black background, and
// remove the decorations. (This includes the title bar and close, minimize and
// maximize buttons and the border)
setUndecorated(false);
setVisible(true);
setSize(width,height);
setResizable(false);
setBackground(Color.black);
// Initializes the background Image
Image background = Toolkit.getDefaultToolkit().getImage("background.gif");
// This is included for debugging with a decorated window.
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} // end constructor
public void paintComponent(Graphics g)
super.paintComponent(g);
} // end paintComponenet
} // end QubicGUITwo things I want to know:
1. I was trying to access a variable as JLabel
myLabel; defined in the constructor of a class from
the constructor of another class. I got this error
message - "Cannot access non-static variable from a
static context". Why(When both are non-static am I
getting the message as static context)?Post some code. It's hard to pinpoint a syntax error like that without seeing the code.
Also, there may be cleaner ways of doing what you want without having classes sharing labels.
2. I am using a map to set the attributes of a font.
One of the key-value pair of the map is
TextAttributesHashMap.put(TextAttribute.FOREGROUND,Colo
.BLUE);
But when I using the statement g.drawString("First
line of the address", 40, 200); the text being
displayed is in black and not blue. Why?You need to use the drawString that takes an AttributedCharacterIterator:
import java.awt.*;
import java.awt.font.*;
import java.text.*;
import javax.swing.*;
public class Example extends JPanel {
public static void main(String[] args) {
JFrame f = new JFrame("Example");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container cp = f.getContentPane();
cp.add(new Example());
f.setSize(400,300);
f.setLocationRelativeTo(null);
f.setVisible(true);
protected void paintComponent(Graphics g) {
super.paintComponent(g);
String text = "Every good boy does fine always";
AttributedString as = new AttributedString(text);
as.addAttribute(TextAttribute.FAMILY, "Lucida Bright");
as.addAttribute(TextAttribute.SIZE, new Float(16));
as.addAttribute(TextAttribute.FOREGROUND, Color.BLUE, 0, 5);
as.addAttribute(TextAttribute.FOREGROUND, Color.GREEN, 6, 10);
as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 11, 14);
as.addAttribute(TextAttribute.FOREGROUND, Color.YELLOW, 15, 19);
as.addAttribute(TextAttribute.FOREGROUND, Color.MAGENTA, 20, 24);
as.addAttribute(TextAttribute.FOREGROUND, Color.CYAN, 25, 31);
g.drawString(as.getIterator(), 10, 20); -
Cannot resolve symbol readShort
Could someone please tell me what I am doing wrong.
I am trying to read a binary file in which the elements are stored in
16 bit integers.
When compiling, I get the error
create2.java:34: cannot resolve symbol
symbol : method readShort (short)
location: class java.io.FileInputStream
while ((len = fromFile.readShort(buffer)) != -1)
Thanks
import java.io.*;
import java.io.FileInputStream.*;
import java.lang.String.*;
public class create2
public static void main (String args[])
FileInputStream fromFile = new FileInputStream("dwwba427.dat");
try
short buffer;
int len;
while ((len = fromFile.readShort(buffer)) != -1)
catch(IOException e)
System.err.println("Error reading. IOException : " + e);
}Thanks, that worked.
I added to the code
fromFile2 = new DataInputStream(fromFile);
while ((i = fromFile2.readShort()) != -1) -
Hi all,
i am using the Scanner class, while compiling i got an error cannot resolve the symbol Scanner. i checked my j.dk version also and it's 1.6
syntax:
File file = new File(fileName);
Scanner scanner = new Scanner(file);
error:
TextScanner.java:10: cannot resolve symbol
symbol : class Scanner
location: class TextScanner
Scanner scanner = new Scanner(file);
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing).
any help is appreciated.i have already imported that class.
C:\Testing\junk\src>javac -d ..\classes forums\java\sun\Test.java
forums\java\sun\Test.java:14: cannot find symbol
symbol : class Scanner
location: class forums.java.sun.Test
Scanner tester = new Scanner(System.in);
^This is the error I got without the import statement. Notice that it is eeriely similar to the error you received.
Adding the above import fixed my problem. Make sure you are saving the file before trying to compile it, and that you are not compiling an older version.
~Tim
EDIT: well, that would do it also! -
Cannot Resolve Symbol netscape.javascript.JSObject
I am trying to communicate fom an applet to a javascript. I am usinjg jdk1.3.1 and did an import netscape.javascript.JSObject; in my applet class.
When I compile I get cannot resolve symbol JSObject. The import does not seem to work.
Do I have to download the package from somewhere and put it in the jdk1.3.1 dir in some place?
ThanksIve netscape 7.1 and the JSDK 1.4.2. The Java40.Jar doesnt seem to be present in my netscape folder anywhere so I assume that it isnt included in the newest version of netscape.
I tried using the javaws.jar that came with my JSDK but it didnt work. I opened it up and searched it and saw no mention of a JSObject file.
Im a little confused at this point. Where can I look up the location of the JSObject? -
"cannot resolve symbol" help..
Here is a very short and simpel program that won't compile after I reinstalled java on my computer.
import java.lang.Math.*;
import java.awt.*;
public class PiTest extends Frame {
public static void main(String[] p){
System.out.println("testing MATHs");
System.out.println(""+sin(10));
I get the following error:
PiTest.java:8: cannot resolve symbol
symbol : method sin (int)
location: class PiTest
System.out.println(""+sin(10));
^
[total 1553ms]
1 error
Why doesn't the compiler recognise the sine function? I have set my classpath to c:\j2sdk1.4.1_01\lib.
I don't know what I'm doing wrong...Replace sin(10) with Math.sin(10), it should work.
import java.lang.Math.*;
import java.awt.*;
public class PiTest extends Frame {
public static void main(String[] p){
System.out.println("testing MATHs");
//System.out.println(""+sin(10));
System.out.println(""+Math.sin(10)); -
hi all,
i wrote one small program by using Date class in java.sql.Date. when i was writing the progam like :
private String day;
private String month;
private String year;
private Date cust_dob;
public void setDay(String s)
day = s;
public String getDay()
return day;
public void setMonth(String s)
month = s;
public String getMonth()
return month;
public void setYear(String s)
year = s;
public String getYear()
return year;
public Date getCust_dob()
cust_dob = valueOf(year + "-" + month + "-" + day);
return cust_dob;
}when i was compiling this program i am getting an error i.e.
CANNOT RESOLVE SYMBOL valueOf(String )
if any budy have an idea about this please give me the solution sir,
Thank you, advancethank you very much sir for giving solution
i changed my code as u said
public Date getCust_dob()
cust_dob = Date.valueOf(year + "-" + month + "-" + day);
return cust_dob;
}now it is not giving any error's. My bug was cleared thank you sir.. -
Cannot resolve symbol java.awt.graphics
// DrawRectangleDemo.java
import java.awt.*;
import java.lang.Object;
import java.applet.Applet;
public class DrawRectangleDemo extends Applet
public void paint (Graphics g)
// Get the height and width of the applet's drawing surface.
int width = getSize ().width;
int height = getSize ().height;
int rectWidth = (width-50)/3;
int rectHeight = (height-70)/2;
int x = 5;
int y = 5;
g.drawRect (x, y, rectWidth, rectHeight);
g.drawString ("drawRect", x, rectHeight + 30);
x += rectWidth + 20;
g.fillRect (x, y, rectWidth, rectHeight);
// Calculate a border area with each side equal tp 25% of
// the rectangle's width.
int border = (int) (rectWidth * 0.25);
// Clear 50% of the filled rectangle.
g.clearRect (x + border, y + border,
rectWidth - 2 * border, rectHeight - 2 * border);
g.drawString ("fillRect/clearRect", x, rectHeight + 30);
x += rectWidth + 20;
g.drawRoundRect (x, y, rectWidth, rectHeight, 15, 15);
g.drawString ("drawRoundRect", x, rectHeight + 30);
x=5;
y += rectHeight + 40;
g.setColor (Color.yellow);
for (int i = 0; i < 4; i++)
g.draw3DRect (x + i * 2, y + i * 2,
rectWidth - i * 4, rectHeight - i * 4, false);
g.setColor (Color.black);
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
x += rectWidth + 20;
g.setColor (Color.yellow);
g.fill3DRect (x, y, rectWidth, rectHeight, true);
g.setColor (Color.black);
g.drawString ("fill3DRect", x, y, + rectHeight + 25);
Help me with this codes. I typed correctly but there still errors.
--------------------Configuration: JDK version 1.3.1 <Default>--------------------
D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:56: cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
location: class java.awt.Graphics
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
^
D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:64: cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
location: class java.awt.Graphics
g.drawString ("fill3DRect", x, y, + rectHeight + 25);
^
2 errors
Process completed.
-------------------------------------------------------------------------------------------------------------------------------cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
This is telling you that you are trying to invoke the drawString() method with 4 parameters: String, int, int, int
If you look at the API the drawString() method need 3 parameters: String, int, int - so you have an extra int
location: class java.awt.Graphics
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
Now is you look at your code you will find that you have 3 ',' in you method call. (I don't think you want the ',' after the y. -
Why do I get a "cannot resolve symbol"
Hi all,
whenever I run my program it always gives me this error :
Mortgage5.java:14: cannot resolve symbol
symbol : class Loan
location: class Mortgage5
Loan theLoan;
^
This program will work in Win 98 and XP but on my other machine running Windows 2000 will not work.
My Mortgage5 class is actually creating an object of another class called Loan which is perfectly fine in other Windows OS but not my 2000, why is that so? I am really puzzled.Hi Kusek,
here is my code that works on other OS but not 2000.
import java.text.*;
public class Mortgage5
{ public static void main (String args[])
{ double thePrincipal;
double theRate;
int theYears;
String loanType;
String theName;
Loan theLoan;
Customer theCust = new Customer();
NumberFormat nf = NumberFormat.getCurrencyInstance();
theName = Console.readString("Customer Name : ");
theCust.setName(theName);
loanType = Console.readString("Loan Type (V/I): ");
thePrincipal = Console.readDouble
("Loan amount (no commas) :");
theRate = Console.readDouble
("Interest rate in % (ex: use 7.5 for 7.5%) :")/100;
theYears = Console.readInt ("The number of theYears:");
if (loanType.equals("V")) {
theLoan = new VariableLoan(thePrincipal, theRate, theYears, theCust);
theLoan.setPrincipal(thePrincipal);
theLoan.setRate(theRate);
theLoan.setYears(theYears);
else {
theLoan = new InterestLoan(thePrincipal, theRate, theYears, theCust);
theLoan.setPrincipal(thePrincipal);
theLoan.setRate(theRate);
theLoan.setYears(theYears);
System.out.println("Customer = "+ theCust.getName());
System.out.println("Monthly payment = "+ nf.format(theLoan.monthlyPayment()));
System.out.println("Total Payment = "+ nf.format(theLoan.totalPayment()));
System.out.println("Total Interest = "+ nf.format(theLoan.totalInterest()));
Maybe you are looking for
-
Help: How to assign dynamically a javascript variable to a jsp variable???
Hello all, What I need to do is to assign the value of the html form element which is a checkbox in this case: <input name="ADB02_checkbox" type=checkbox id="ADB02_checkbox" onClick="decide_enable_or_disable_particular_checkbox()" value="ADB02"> to a
-
How do you create a second library?
i want a second library so i can have a separate library to import cds into mp3s without messing up my old library. help please!
-
A few days ago my iMac (late 2013 model) started acting wonky. I had figured out that it was because I had done a migration from my previous iMac and it had brought along some corrupted files that were still causing me trouble. I decided to do a clea
-
How do i send a sms though iMessage
.
-
I can not Install an app downloaded to my pc, on my ipad
I used my PC to download apps from apple store. The app is saved on the PC. When I am trying to sync my ipad with the itunes on the PC and get the app installed. The procedure suddenly stops on step 3 (determining apps to sync) . I have tryed some so