Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Trouble with Javabean and separate class.

Posted on 2003-03-18
2
Medium Priority
?
254 Views
Last Modified: 2013-11-23
I have two .java files.
DataSet and joData both in a directory/package called databeans in Tomcat in the classes directory of my webapp.
When I javac DataSet, no problem.
But when I try to javac joData it gets the following error:

joData.java:5: cannot resolve symbol
symbol  : class DataSet
location: package databeans
import databeans.DataSet;
                 ^
joData.java:21: cannot resolve symbol
symbol  : class DataSet
location: class databeans.joData
                DataSet returnrecs = new DataSet();
                ^
joData.java:21: cannot resolve symbol
symbol  : class DataSet
location: class databeans.joData
                DataSet returnrecs = new DataSet();
                                         ^
Here are the two .java files

DataSet.java:

package databeans;
import java.util.*;
import java.sql.*;
public class DataSet
{
     public String Fname;
     public String Lname;
     public String CID;
     public String Phone;
     public String Email;
     public String CoID;
     public String CName;
}

joData.java:

package databeans;

import java.util.*;
import java.sql.*;
import databeans.DataSet;

public class joData
{


public Vector getData() throws Exception

{
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       Connection con = DriverManager.getConnection("jdbc:odbc:Remedy","sa","bubba");
       Statement stmt = con.createStatement();
       Vector records = new Vector();
       ResultSet rs = stmt.executeQuery("SELECT Contact_ID, First_Name, Last_Name, Phone__, Email_Address, Company_ID, Company_Name   FROM base_Contact WHERE (Contact_Status = 0) AND (Company_Name <> 'Apropos') AND (Last_Name <> 'Test') ORDER BY Company_Name, Last_Name");
       while (rs.next())
       {
          DataSet returnrecs = new DataSet();
          returnrecs.CID = rs.getString("Contact_ID");
          returnrecs.Fname = rs.getString("First_Name");
          returnrecs.Lname = rs.getString("Last_Name");
          returnrecs.Phone = rs.getString("Phone__");
          returnrecs.Email = rs.getString("Email_Address");
          returnrecs.CoID = rs.getString("Company_ID");
          returnrecs.CName = rs.getString("Company_Name");
          records.addElement(returnrecs);
     }
    con.close();
     return records;
}

}

Could someone help me figure out why I get that error when trying to compile joData?

thanks,

Ed
0
Comment
Question by:eteune
2 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 80 total points
ID: 8162486
import databeans.DataSet;

is DataSet also in package databeans? if so, you don't need the above line.
what IDE are you using?

try doing javac -classpath . joData.java
(so that it includes the class files in the current directory)



0
 

Author Comment

by:eteune
ID: 8162603
That did it, I needed to include the classpath, thanks,
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question