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?

Similar Messages

  • "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
    mark

    I 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

  • 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..
    addi

    Is 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 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.
    2Willis4

    Hi 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.

  • Java Bean Error in JSP: Cannot Resolve Symbol FirstBean

    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 StudentBean 
    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 ...

    Error is for StudentBean, not for FirstBean. So check for it.

  • 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?

  • Very annoying "cannot resolve symbol" error

    I have 2 classes, an Item class and a Storefront class. The Storefront class uses the Item class. The item class compiles fine but when I try to compile the Storefront.java class i get the following errors.
    C:\J21WORK\DAY6EXS>javac Storefront.java
    Storefront.java:16: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    public Item getItem(int i) {
    ^
    Storefront.java:12: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    Item it = new Item(id, name, price, quant);
    ^
    Storefront.java:12: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    Item it = new Item(id, name, price, quant);
    ^
    Storefront.java:17: cannot resolve symbol
    symbol : class Item
    location: class J21Work.Day6Exs.Storefront
    return (Item)catalog.get(i);
    ^
    4 errors
    C:\J21WORK\DAY6EXS>
    the source code for Item.java is:
    package J21Work.Day6Exs;
    import java.util.*;
    public class Item implements Comparable {
    private String id;
    private String name;
    private double retail;
    private int quantity;
    private double price;
    Item(String idIn, String nameIn, String retailIn, String quanIn) {
    id = idIn;
    name = nameIn;
    retail = Double.parseDouble(retailIn);
    quantity = Integer.parseInt(quanIn);
    if (quantity > 400)
    price = retail * .5D;
    else if (quantity > 200)
    price = retail * .6D;
    else
    price = retail * .7D;
    price = Math.floor( price * 100 + .5 ) / 100;
    public int compareTo(Object obj) {
    Item temp = (Item)obj;
    if (this.price < temp.price)
    return 1;
    else if (this.price > temp.price)
    return -1;
    return 0;
    public String getId() {
    return id;
    public String getName() {
    return name;
    public double getRetail() {
    return retail;
    public int getQuantity() {
    return quantity;
    public double getPrice() {
    return price;
    the source code for Storefront.java is:
    package J21Work.Day6Exs;
    import java.util.*;
    public class Storefront {
    private LinkedList catalog = new LinkedList();
    public void addItem(String id, String name, String price,
    String quant) {
    Item it = new Item(id, name, price, quant);
    catalog.add(it);
    public Item getItem(int i) {
    return (Item)catalog.get(i);
    public int getSize() {
    return catalog.size();
    public void sort() {
    Collections.sort(catalog);
    my classpath is set to: .;C:\j2sdk1.4.1_01\lib\tools.jar;C:\J21Work\Day6Exs;.
    ne help wpuld be greatly appreciated..thanks everyone

    hi there partners i also having the same problems i looked each line very carefully but cant find the way out my code is :
    package com.dsta.aims.pinmailer.notifier;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.Properties;
    import com.activcard.aims.event.AIMSEvent;
    import com.activcard.aims.event.AIMSEventAdapter;
    import com.dsta.aims.pinmailer.AimsDeviceDb;
    public class PinMailerNotifier extends AIMSEventAdapter {
         // Plugin information
         private final static String version = "1.0";
         private final static String name = "com.dsta.aims.pinmailer";
         // The name of the properties file
         final static String PROPERTIES_FILE = "pin_mailer.properties";
         // The names of the properties we look for
         private final static String CONF_DATABASE_FILE="DatabaseFile";
         private final static String CONF_LOG_FILE="LogFile";
         // Default property values
         private final static String DEF_DATABASE_FILE="cuids.db";
         private final static String DEF_LOG_FILE=null;
         private AimsDeviceDb db;
         private String log_file;
         private String db_file;
         * Log function to send some output to a log file. This is really just needed
         * for debuging/testing when making changes to this plugin. Should not
         * be needed in production.
         * @param msg Message to log
         private void log(String msg)
              if (log_file == null) {
                   return;
              String newline = System.getProperty("line.separator");
              FileWriter fout ;
              try {
                   fout = new FileWriter(log_file, true);
                   fout.write(msg + newline);
                   fout.flush();
                   fout.close();
              } catch (IOException e1) {
                   // nothing
         public void init() {
              Properties conf = new Properties();
              try {
                   conf.load(getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE));
              } catch (Exception e) {
                   log("Unable to load properties file:" + PROPERTIES_FILE);
              log_file = conf.getProperty(CONF_LOG_FILE, DEF_LOG_FILE);
              db_file = conf.getProperty(CONF_DATABASE_FILE, DEF_DATABASE_FILE);
              log("Init " + name + "/" + version + ": database is " + db_file);
              String jdbc_name = "jdbc:sqlite:/" + db_file;
              db = new AimsDeviceDb();
              if (!db.openDatabase(jdbc_name)) {
                   log("Failed to open the database " + jdbc_name);
                   db = null;
                   // TODO: What should we do here?
              } else {
                   log("Opened the database " + jdbc_name);
         public void onDeviceEventReceived(AIMSEvent event) {
              log("--> Event for Device");
              // check that this is a device issue and/or unlock event
              if (event.getEventID() != AIMSEvent.EVENT_ISSUE_DEVICE &&
                   event.getEventID() != AIMSEvent.EVENT_UNLOCK_DEVICE) {
                        log("... wrong event type");
                        return;
              // check that the status is succesfull
              if (event.getStatus() != 0) {
                   log("... wrong status");
                   return;
              // If issue event check that it a permanent card
              if (event.getEventID() == AIMSEvent.EVENT_ISSUE_DEVICE &&
                   event.getAdditionalInfoNum1() != 0) {
                        log("... not a perm card");
                        return;
              // store event in database
              String device_id = event.getClientID();
              String device_type = event.getAdditionalInfoChar1();
              log("... Ok. Add to database" + device_id + "/" + device_type);
              db.insert(device_id, device_type);
         public void onUserEventReceived(AIMSEvent event) {
              log("--> Event for User");
         public void onRequestEventReceived(AIMSEvent event) {
              log("--> Event for Request");
         public void onCredentialEventReceived(AIMSEvent event) {
              log("--> Event for Credential");
         public void onEventReceived(AIMSEvent event) {
              log("--> Event");
         public void onAuthenticationEventReceived(AIMSEvent evt) {
              log("--> Event for Authentication");
         public String getVersion()     {
              return version;
         public String getName() {
              return name;
    and have such error :
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:20: cannot resolve symbol
    symbol : class AIMSEvent
    location: package event
    import com.activcard.aims.event.AIMSEvent;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:21: cannot resolve symbol
    symbol : class AIMSEventAdapter
    location: package event
    import com.activcard.aims.event.AIMSEventAdapter;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:22: cannot resolve symbol
    symbol : class AimsDeviceDb
    location: package pinmailer
    import com.dsta.aims.pinmailer.AimsDeviceDb;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:34: cannot resolve symbol
    symbol : class AIMSEventAdapter
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
    public class PinMailerNotifier extends AIMSEventAdapter {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:47: cannot resolve symbol
    symbol : class AimsDeviceDb
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         private AimsDeviceDb db;
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:104: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onDeviceEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:138: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onUserEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:145: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onRequestEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:152: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onCredentialEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:159: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onEventReceived(AIMSEvent event) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:166: cannot resolve symbol
    symbol : class AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
         public void onAuthenticationEventReceived(AIMSEvent evt) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:81: cannot resolve symbol
    symbol : method getClass ()
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
                   conf.load(getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE));
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:91: cannot resolve symbol
    symbol : class AimsDeviceDb
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
              db = new AimsDeviceDb();
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:108: cannot resolve symbol
    symbol : variable AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
              if (event.getEventID() != AIMSEvent.EVENT_ISSUE_DEVICE &&
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:109: cannot resolve symbol
    symbol : variable AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
                   event.getEventID() != AIMSEvent.EVENT_UNLOCK_DEVICE) {
    ^
    E:\unzip-pinmailer\com\dsta\aims\pinmailer\notifier\PinMailerNotifier.java:121: cannot resolve symbol
    symbol : variable AIMSEvent
    location: class com.dsta.aims.pinmailer.notifier.PinMailerNotifier
              if (event.getEventID() == AIMSEvent.EVENT_ISSUE_DEVICE &&
    ^
    16 errors
    Tool completed with exit code 1
    plz plz reply me asap and thanx in advance what the hell is wrong with this code

  • Class error - cannot resolve symbol "MyDocumentListener"

    Hello,
    this is a groaner I'm sure, but I don't see the problem.
    Newbie-itis probably ...
    I'm not concerned with what the class does, but it would be nice for the silly thing to compile!
    What the heck am I missing for "MyDocumentListener" ?
    C:\divelog>javac -classpath C:\ CenterPanel.java
    CenterPanel.java:53: cannot resolve symbol
    symbol : class MyDocumentListener
    location: class divelog.CenterPanel
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    ^
    CenterPanel.java:53: cannot resolve symbol
    symbol : class MyDocumentListener
    location: class divelog.CenterPanel
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    ^
    2 errors
    package divelog;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.lang.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    import javax.swing.text.*;
    public class CenterPanel extends JPanel implements ActionListener
    { // Opens class
    static private final String newline = "\n";
    private JTextArea comments;
    private JScrollPane scrollpane;
    private JButton saveButton, openButton;
    private JLabel whiteshark;
    private Box box;
    private BufferedReader br ;
    private String str;
    private JTextArea instruct;
    private File defaultDirectory = new File("C://divelog");
    private File fileDirectory = null;
    private File currentFile= null;
    public CenterPanel()
    { // open constructor CenterPanel
    setBackground(Color.white);
    comments = new JTextArea("Enter comments, such as " +
    "location, water conditions, sea life you observed," +
    " and problems you may have encountered.", 15, 10);
    comments.setLineWrap(true);
    comments.setWrapStyleWord(true);
    comments.setEditable(true);
    comments.setFont(new Font("Times-Roman", Font.PLAIN, 14));
    // add a document listener for changes to the text,
    // query before opening a new file to decide if we need to save changes.
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    comments.getDocument().addDocumentListener(myDocumentListener); // create the reference for the class
    // ------ Document listener class -----------
    class MyDocumentListener implements DocumentListener {
    public void insertUpdate(DocumentEvent e) {
    Calculate(e);
    public void removeUpdate(DocumentEvent e) {
    Calculate(e);
    public void changedUpdate(DocumentEvent e) {
    private void Calculate(DocumentEvent e) {
    // do something here
    scrollpane = new JScrollPane(comments);
    scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    saveButton = new JButton("Save Comments", new ImageIcon("images/Save16.gif"));
    saveButton.addActionListener( this );
    saveButton.setToolTipText("Click this button to save the current file.");
    openButton = new JButton("Open File...", new ImageIcon("images/Open16.gif"));
    openButton.addActionListener( this );
    openButton.setToolTipText("Click this button to open a file.");
    whiteshark = new JLabel("", new ImageIcon("images/gwhite.gif"), JLabel.CENTER);
    Box boxH;
    boxH = Box.createHorizontalBox();
    boxH.add(openButton);
    boxH.add(Box.createHorizontalStrut(15));
    boxH.add(saveButton);
    box = Box.createVerticalBox();
    box.add(scrollpane);
    box.add(Box.createVerticalStrut(10));
    box.add(boxH);
    box.add(Box.createVerticalStrut(15));
    box.add(whiteshark);
    add(box);
    } // closes constructor CenterPanel
    public void actionPerformed( ActionEvent evt )
    { // open method actionPerformed
    JFileChooser jfc = new JFileChooser();
    // these do not work !!
    // -- set the file types to view --
    // ExtensionFileFilter filter = new ExtensionFileFilter();
    // FileFilter filter = new FileFilter();
    //filter.addExtension("java");
    //filter.addExtension("txt");
    //filter.setDescription("Text & Java Files");
    //jfc.setFileFilter(filter);
         //Add a custom file filter and disable the default "Accept All" file filter.
    jfc.addChoosableFileFilter(new JTFilter());
    jfc.setAcceptAllFileFilterUsed(false);
    // -- open the default directory --
    // public void setCurrentDirectory(File dir)
    // jfc.setCurrentDirectory(new File("C://divelog"));
    jfc.setCurrentDirectory(defaultDirectory);
    jfc.setSize(400, 300);
    jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    Container parent = saveButton.getParent();
    //========================= Test Button Actions ================================
    //========================= Open Button ================================
    if (evt.getSource() == openButton)
    int choice = jfc.showOpenDialog(CenterPanel.this);
    File file = jfc.getSelectedFile();
    /* a: */
    if (file != null && choice == JFileChooser.APPROVE_OPTION)
    String filename = jfc.getSelectedFile().getAbsolutePath();
    // -- compare the currentFile to the file chosen, alert of loosing any changes to currentFile --
    // If (currentFile != filename)
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    try
    { //opens try         
    comments.getLineCount( );
    // -- clear the old data before importing the new file --
    comments.selectAll();
    comments.replaceSelection("");
    // -- get the new data ---
    br = new BufferedReader (new FileReader(file));
    while ((str = br.readLine()) != null)
    {//opens while
    comments.append(str);
    } //closes while
    } // close try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Open command not successful:" + ioe + newline);
    } // close catch
    // ---- display the values of the directory variables -----------------------
    comments.append(
    newline + "The f directory variable contains: " + f +
    newline + "The fileDirectory variable contains: " + fileDirectory +
    newline + "The defaultDirectory variable contains: " + defaultDirectory );
    else
    comments.append("Open command cancelled by user." + newline);
    } //close if statement /* a: */
    //========================= Save Button ================================
    } else if (evt.getSource() == saveButton)
    int choice = jfc.showSaveDialog(CenterPanel.this);
    if (choice == JFileChooser.APPROVE_OPTION)
    File fileName = jfc.getSelectedFile();
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    //check for existing files. Warn users & ask if they want to overwrite
    for(int i = 0; i < fileName.length(); i ++) {
    File tmp = null;
    tmp = (fileName);
    if (tmp.exists()) // display pop-up alert
    //public static int showConfirmDialog( Component parentComponent,
    // Object message,
    // String title,
    // int optionType,
    // int messageType,
    // Icon icon);
    int confirm = JOptionPane.showConfirmDialog(null,
    fileName + " already exists on " + fileDirectory
    + "\n \nContinue?", // msg
    "Warning! Overwrite File!", // title
    JOptionPane.OK_CANCEL_OPTION, // buttons displayed
                        // JOptionPane.ERROR_MESSAGE
                        // JOptionPane.INFORMATION_MESSAGE
                        // JOptionPane.PLAIN_MESSAGE
                        // JOptionPane.QUESTION_MESSAGE
    JOptionPane.WARNING_MESSAGE,
    null);
    if (confirm != JOptionPane.YES_OPTION)
    { //user cancels the file overwrite.
    try {
    jfc.cancelSelection();
    break;
    catch(Exception e) {}
    // ----- Save the file if everything is OK ----------------------------
    try
    { // opens try
    BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
    bw.write(comments.getText());
    bw.flush();
    bw.close();
    comments.append( newline + newline + "Saving: " + fileName.getName() + "." + newline);
    break;
    } // closes try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Save command unsuccessful:" + ioe + newline);
    } // close catch
    } // if exists
    } //close for loop
    else
    comments.append("Save command cancelled by user." + newline);
    } // end-if save button
    } // close method actionPerformed
    } //close constructor CenterPanel
    } // Closes class CenterPanel

    There is no way to be able to see MyDocumentListener class in the way you wrote. The reason is because MyDocumentListener class inside the constructor itself. MyDocumentListener class is an inner class, not suppose to be inside a constructor or a method. What you need to do is simple thing, just move it from inside the constructor and place it between two methods.
    that's all folks
    Qusay

  • 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

  • Cannot resolve symbol : class odbc ERROR

    Hi Helper
    I am trying to compile a the following and I am getting the error
    C:\jdk\websiter>javac MainServlet.java
    MainServlet.java:86: cannot resolve symbol
    symbol : class odbc
    location: package jdbc
    Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    * This is the servlet to send the user the names of all the sites present in the database
    public class MainServlet extends HttpServlet implements ServletConstants
    Connection m_con;
    PreparedStatement m_pstmt;
    ResultSet m_res;
    Vector m_vecsiteName;
    public void Init(ServletConfig config) throws ServletException {
         super.init(config);
    }// end of init()
    public void service(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
              m_vecsiteName = new Vector();
         try {
         Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
    m_con = DriverManager.getConnection("jdbc:odbc:sitewd", "", "");
    How can i fix it? thanks
    VT

    Replace the Statement
    Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
    as
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

  • Cannot resolve symbol when the classes are in the same package

    i have one interface and two classes all in the same package. am getting " cannot resolve symbol", when the code refers to the interface or the class .
    the package name is collections.impl and
    the directory i used to store all the java files:
    c:\jdk\bin\collections\impl.
    isthere any othe option other than compiling all the files from the comand line at the same time?
    please help - i m new to java.

    If you have:
    I.java:
    package some;
    public interface I {
        void method();
    }A.java:
    package some;
    public class A implements I {
        public void method() {
            new B();
    }B.java:
    package some;
    public class B implements I {
        public void method() {
            new A();
    }in c:/temp/some for example
    you can compile your files with
    javac c:/temp/some/*.java
    It seems that you have errors in your code.
    Recheck it twice or use NetBeans IDE(http://www.netbeans.org) it will do this for you ;)

  • 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.

  • 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...

  • Error: Cannot Resolve symbol

    Hi i have written this program but it is not compling properly. i do not know what to do to sort it. here is the code:
    import java.sql.*;
    import java.io.DataInputStream;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Phase1 extends JFrame implements ActionListener, MouseListener
         //Create Buttons and Text areas etc for the GUI itself
         JButton add, current, delete, order, all, exit;
         JTextField textStockCode, textStockDesc, textCurrentLevel, textReorderLevel, textPrice;
         JTextArea textarea;
         JScrollPane pane1;
         JLabel labelStockCode, labelStockDesc, labelCurrentLevel, labelReorderLevel, labelPrice, labelTextArea;
         String stockCode, stockDesc, currentLevel, reorderLevel, price;
         JLabel welcome;
         //Setup database connections and statements for later use
         Connection db_connection;
         Statement db_statement;
         public Phase1()
              //Display a welcome message before loading system onto the screen
              JOptionPane.showMessageDialog(null, "Welcome to the Stock Control System");
              //set up the GUI environment to use a grid layout
              Container content=this.getContentPane();
              content.setLayout(new GridLayout(3,6));
              //Inititlise buttons
              add=new JButton("Add");
              add.addActionListener(this);
              current=new JButton("Show Current Level");
              current.addActionListener(this);
              delete=new JButton("Delete");
              delete.addActionListener(this);
              order=new JButton("Place Order");
              order.addActionListener(this);
              all = new JButton("Show All Entries");
              all.addActionListener(this);
              exit = new JButton("Exit");
              exit.addActionListener(this);
              //Add Buttons to the layout
              content.add(add);
              content.add(current);
              content.add(delete);
              content.add(order);
              content.add(all);
              content.add(exit);
              //Initialise text fields for inputting data to the database and
              //Add mouse listeners to clear the boxs on a click event
              textStockCode = new JTextField("");
              textStockCode.addMouseListener(this);
              textStockDesc = new JTextField("");
              textStockDesc.addMouseListener(this);
              textCurrentLevel = new JTextField("");
              textCurrentLevel.addMouseListener(this);
              textReorderLevel = new JTextField("");
              textReorderLevel.addMouseListener(this);
              textPrice = new JTextField("");
              textPrice.addMouseListener(this);
              //Initialise the labels to label the Text Fields
              labelStockCode = new JLabel("Stock Code");
              labelStockDesc = new JLabel("Stock Description");
              labelCurrentLevel = new JLabel("Current Level");
              labelReorderLevel = new JLabel("Re-Order Level");
              labelPrice = new JLabel("Price");
              labelTextArea = new JLabel("All Objects");
              //Add Text fields and labels to the GUI
              content.add(labelStockCode);
              content.add(textStockCode);
              content.add(labelStockDesc);
              content.add(textStockDesc);
              content.add(labelCurrentLevel);
              content.add(textCurrentLevel);
              content.add(labelReorderLevel);
              content.add(textReorderLevel);
              content.add(labelPrice);
              content.add(textPrice);
              content.add(labelTextArea);
              //Create a text area with scroll bar for showing Entries in the text area
              textarea=new JTextArea();
              textarea.setRows(6);
              pane1=new JScrollPane(textarea);
              content.add(pane1);
              //Try to connect to the database through ODBC
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                   //Create a URL that identifies database
                   String url = "jdbc:odbc:" + "stock";
                   //Now attempt to create a database connection
                   //First parameter data source, second parameter user name, third paramater
                   //password, the last two paramaters may be entered as "" if no username or
                   //pasword is used
                   db_connection = DriverManager.getConnection(url, "demo","");
                   //Create a statement to send SQL
                   db_statement = db_connection.createStatement();
              catch (Exception ce){} //driver not found
         //action performed method for button click events
         public void actionPerformed(ActionEvent ev)
              if(ev.getSource()==add)               //If add button clicked
                   try
                        add();                         //Run add() method
                   catch(Exception e){}
              if(ev.getSource()==current)
              {     //If Show Current Level Button Clicked
                   try
                        current();                    //Run current() method
                   catch(Exception e){}
              if(ev.getSource()==delete)
              {          //If Show Delete Button Clicked
                   try
                        delete();                    //Run delete() method
                   catch(Exception e){}
              if(ev.getSource()==order)          //If Show Order Button Clicked
                   try
                        order();                    //Run order() method
                   catch(Exception e){}
              if(ev.getSource()==all)          //If Show Show All Button Clicked
                   try
                        all();                         //Run all() method
                   catch(Exception e){}
              if(ev.getSource()==exit)          //If Show Exit Button Clicked
                   try{
                        exit();                         //Run exit() method
                   catch(Exception e){}
         public void add() throws Exception           //add a new stock item
              stockCode = textStockCode.getText();
              stockDesc = textStockDesc.getText();
              currentLevel = textCurrentLevel.getText();
              reorderLevel = textReorderLevel.getText();
              price = textPrice.getText();
              if(stockCode.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure Stock Code is filled out");
              if(stockDesc.equals(""))
                             JOptionPane.showMessageDialog(null,"Ensure Description is filled out");
              if(price.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure price is filled out");
              if(currentLevel.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure Current Level is filled out");
              if(reorderLevel.equals(""))
                   JOptionPane.showMessageDialog(null,"Ensure Re-Order Level is filled out");
              else
                   //Add item to database with variables set from text fields
                   db_statement.executeUpdate("INSERT INTO stock VALUES
    ('"+stockCode+"','"+stockDesc+"','"+currentLevel+"','"+reorderLevel+"','"+price+"')");
         public void current() throws Exception      //check a current stock level
              if(textStockCode.getText().equals(""))//if no stockcode has been entered
                   JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
              else
                   ResultSet resultcurrent = db_statement.executeQuery("SELECT * FROM stock WHERE StockCode = '"+textStockCode.getText()+"'");
                   textarea.setText("");
                   if(resultcurrent.next())
                        do
                             textarea.setText("Stock Code: "+resultcurrent.getString("StockCode")+"\nDescription:
    "+resultcurrent.getString("StockDescription")+"\nCurrent Level: "+resultcurrent.getInt("CurrentLevel")+"\nRe-Order Level:
    "+resultcurrent.getInt("ReorderLevel")+"\nPrice: "+resultcurrent.getFloat("Price"));
                        while(resultcurrent.next());
                   else
                        //Display Current Stock Item (selected from StockCode Text field in the scrollable text area
                        JOptionPane.showMessageDialog(null,"Not a valid Stock Code");
         public void delete() throws Exception          //delete a current stock item
              if(textStockCode.getText().equals(""))          //Check there is a stock code entered
                   JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
              else
                   //Delete Item from database where Stock Code is what is in Stock Code Text Field
                   db_statement.executeUpdate("DELETE * FROM stock WHERE StockCode='"+textStockCode.getText()+"'");
         public void order() throws Exception           //check price for an order
              if(textStockCode.getText().equals(""))          //Check there is a stock code entered
                   JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
              else
                   //Set some variables to aid ordering
                   float price = 0;
                   int currentlevel = 0;
                   int newlevel = 0;
                   int reorder = 0;
                   String StockCode = textStockCode.getText();
                   //Post a message asking how many to order
                   String str_quantity = JOptionPane.showInputDialog(null,"Enter Quantity: ","Adder",JOptionPane.PLAIN_MESSAGE);
                   int quantity = Integer.parseInt(str_quantity);
                   //Get details from database for current item
                   ResultSet resultorder = db_statement.executeQuery("SELECT * FROM stock WHERE StockCode='"+StockCode+"'");
                   //Set variables from database to aid ordering
                   while (resultorder.next())
                        price = resultorder.getFloat("Price");
                        currentlevel = (resultorder.getInt("CurrentLevel"));
                        reorder = (resultorder.getInt("ReorderLevel"));
                   //Set the new level to update the database
                   newlevel = currentlevel - quantity;
                   //calculate the total price of the order
                   float total = price * quantity;
                   //If the stock quantity is 0
                   if(quantity == 0)
                        //Display a message saying there are none left in stock
                        JOptionPane.showMessageDialog(null,"No Stock left for this item");
                   //Otherwise check that the quantity ordered is more than what is lewft in stock
                   else if(quantity > currentlevel)
                        //If ordered too many display a message saying so
                        JOptionPane.showMessageDialog(null,"Not enough in stock, order less");
                   else
                        //Otherwise Display the total in a message box
                        JOptionPane.showMessageDialog(null,"Total is: "+total);
                        //then update the database with new values
                        db_statement.executeUpdate("UPDATE Stock SET CurrentLevel="+newlevel+" WHERE StockCode='"+StockCode+"'");
                        //Check if the new level is 0
                        if(newlevel == 0)
                             //If new level IS 0, send a message to screen saying so
                             JOptionPane.showMessageDialog(null,"There is now no Stock left.");
                        else
                             //otherwise if the newlevel of stock is the same as the reorder level
                             if(newlevel == reorder)
                                  // display a message to say so
                                  JOptionPane.showMessageDialog(null,"You are now at the re-order level, Get some more of this item in
    stock.");
                             //Otherwise if the new level is lower than the reorder level,
                             if(newlevel < reorder)
                                  //Display a message saying new level is below reorder level so get some more stock
                                  JOptionPane.showMessageDialog(null,"You are now below the reorder level. Get some more of this item in
    stock.");
         public void all() throws Exception                //show all stock items and details
              //Get everthing from the database
              ResultSet resultall = db_statement.executeQuery("SELECT * FROM Stock");
              textarea.setText("");
              while (resultall.next())
                   //Display all items of stock in the Text Area one after the other
                   textarea.setText(textarea.getText()+"Stock Code: "+resultall.getString("StockCode")+"\nDescription:
    "+resultall.getString("StockDescription")+"\nCurrent Level: "+resultall.getInt("CurrentLevel")+"\nRe-Order Level:
    "+resultall.getInt("ReorderLevel")+"\nPrice: "+resultall.getFloat("Price")+"\n\n");
         public void exit() throws Exception           //exit
              //Cause the system to close the window, exiting.
              db_connection.commit();
              db_connection.close();
              System.exit(0);
         public static void main(String args[])
              //Initialise a frame
              JDBCFrame win=new JDBCFrame();
              //Set the size to 800 pixels wide and 350 pixels high
              win.setSize(900,350);
              //Set the window as visible
              win.setVisible(true);
              win.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
         //Mouse Listener Commands
         public void mousePressed(MouseEvent evt)
              if (evt.getSource()==textStockCode)
                   //Clear the Stock Code text field on clickin on it
                   textStockCode.setText("");
              else if (evt.getSource()==textStockDesc)
                   //Clear the Stock Description text field on clickin on it
                   textStockDesc.setText("");
              else if (evt.getSource()==textCurrentLevel)
                   textCurrentLevel.setText("");
                   //Clear the Current Level text field on clickin on it
              else if (evt.getSource()==textReorderLevel)
                   textReorderLevel.setText("");
                   //Clear the Re-Order Level text field on clickin on it
              else if (evt.getSource()==textPrice)
                   textPrice.setText("");
                   //Clear the Price text field on clickin on it
         public void mouseReleased(MouseEvent evt){}
         public void mouseClicked(MouseEvent evt){}
         public void mouseEntered(MouseEvent evt){}
         public void mouseExited(MouseEvent evt){}
    }And this is the error that i get when compiling:
    Phase1.java:355: cannot resolve symbol
    symbol  : class JDBCFrame
    location: class Phase1
                    JDBCFrame win=new JDBCFrame();
                    ^
    Phase1.java:355: cannot resolve symbol
    symbol  : class JDBCFrame
    location: class Phase1
                    JDBCFrame win=new JDBCFrame();Thanks for any help you can give me

    The error is very clear here
    Phase1.java:355: cannot resolve symbolsymbol : class JDBCFramelocation: class Phase1 JDBCFrame win=new JDBCFrame();
    Where is this class JDBCFrame()?
    Import that package or class

  • Javac compiler Error - cannot resolve symbol - symbol  StringBuilder?

    Hi ,
    I am using hp - ux system with java version "1.4.2.06". when i try to compile a program called CharSequenceDemo.java which is found in the java tutorials at this link
    [CharSequenceDemo.java|http://java.sun.com/docs/books/tutorial/java/IandI/examples/CharSequenceDemo.java]
    i get the following error:
    $/opt/java1.4/bin/javac CharSequenceDemo.java
    CharSequenceDemo.java:38: cannot resolve symbol
    symbol : class StringBuilder
    location: class CharSequenceDemo
    StringBuilder sub =
    ^
    CharSequenceDemo.java:39: cannot resolve symbol
    symbol : class StringBuilder
    location: class CharSequenceDemo
    new StringBuilder(s.subSequence(fromEnd(end), fromEnd(start)));
    ^
    CharSequenceDemo.java:44: cannot resolve symbol
    symbol : class StringBuilder
    location: class CharSequenceDemo
    StringBuilder s = new StringBuilder(this.s);
    ^
    CharSequenceDemo.java:44: cannot resolve symbol
    symbol : class StringBuilder
    location: class CharSequenceDemo
    StringBuilder s = new StringBuilder(this.s);
    ^
    4 errors
    Please help on how to compile this program.

    I've been struggling with the same issue. The difference is that my system says I'm using version 1.6.0_05. I've tried running jucheck.exe. It tells me I've got the latest version installed.
    Here is the code:
    import java.lang.StringBuilder;
    import java.util.Formatter;
       public class UsingFormatter {
         public static void main(String[] args) {
           if (args.length != 1) {
             System.err.println("usage: " +
               "java format/UsingFormatter <format string>");
             System.exit(0);
           String format = args[0];
           StringBuilder stringBuilder = new StringBuilder();
           Formatter formatter = new Formatter(stringBuilder);
           formatter.format("Pi is approximately " + format +
             ", and e is about " + format, Math.PI, Math.E);
           System.out.println(stringBuilder);
       }When I type javac UsingFormatter.java, I get:
    UsingFormatter.java:1: cannot resolve symbol
    symbol : class StringBuilder
    location: package lang
    import java.lang.StringBuilder;
    ^
    UsingFormatter.java:2: cannot resolve symbol
    symbol : class Formatter
    location: package util
    import java.util.Formatter;
    ^
    UsingFormatter.java:14: cannot resolve symbol
    symbol : class StringBuilder
    location: class UsingFormatter
    StringBuilder stringBuilder = new StringBuilder();
    ^
    UsingFormatter.java:14: cannot resolve symbol
    symbol : class StringBuilder
    location: class UsingFormatter
    StringBuilder stringBuilder = new StringBuilder();
    ^
    UsingFormatter.java:15: cannot resolve symbol
    symbol : class Formatter
    location: class UsingFormatter
    Formatter formatter = new Formatter(stringBuilder);
    ^
    UsingFormatter.java:15: cannot resolve symbol
    symbol : class Formatter
    location: class UsingFormatter
    Formatter formatter = new Formatter(stringBuilder);
    ^
    6 errors
    The compiler refuses to recognize the symbols StringBuilder and Formatter.
    I have spent hours googling for an answer and trying every suggestion. Nothing works, not even the one about dropping the computer from the rooftop.
    Ultimately, what I'm trying to accomplish (in a different program) is to use a text file as a form letter template and replace the %s placeholders with stings from my form object.
    Any advice?
    Edited by: javastudent_99 on Apr 3, 2008 1:48 PM

Maybe you are looking for

  • Error while opening Cfolder URL Link.

    Hi, I get BSP error while opening cfolder URL link in BID Invitation Header data --> Document tab and click on the hyperlink for the cfolder. Following is the BSP error. Business Server Page (BSP) error What happened? Calling the BSP page was termina

  • Appalling customer service. Problem with Infinity ...

    Placed order for upgrade from Bt Broadband to Infinity 1 on Tuesday 19th March. Was given installation date of Tuesday 26th March (Today). All started well when engineer arrived at 9am. He had already done the necessarys in the cabinet up the road so

  • Loop in combination with Analog output

    Hi I have modified the script thats translate a value in to a static analog output voltage. The value comes from another online running application. The analog output value must remain static until a new value arise. I'm using VB6 and DAQmx 8.5 on a

  • How do i update my itunes to the 11.1 software so that i can sync my iphone 4s?

    How do i update my itunes to the 11.1 software so that i can sync my iphone 4s to my itunes account?

  • Blurry Scroll Bars on Cover Flow

    I know this has been posted last month, but no one answered it. Is there any fix to the blurry scroll bars in iTunes? It's a little embarrassing to have my cool Apple look gross in iTunes... Thanks!