?
Solved

Stuck with Packages!

Posted on 2003-02-20
8
Medium Priority
?
235 Views
Last Modified: 2010-03-31
Dear BrainBags,

This is a very simple problem which has taken my good amount of time. I am using 2 java files which are in my corejavalib directory. My directory structure is something like this -

C:\glueI\corejavalib

and my 2 java files are in corejavalib directory since these files are the part of corejavalib package. Here is a simple code of my 2 java files.

/* DBAdapter.java file */
package corejavalib;

public class DBAdapter
{
     DBCommond myC = new DBCommond();

     public String getAdaptorName()
     {
          return "ORACLE";
     }
     
     public String getCommondTypeMode()
     {
          return myC.getCommondType();
     }
}



/* DBCommond.java file */
package corejavalib;

public class DBCommond
{
     public String getCommondType()
     {
          return "INSERT";
     }
}


Now the problem is that when I compile DBAdapter.java file it gives me the error that it cannot able to compile DBCommond class. Can anybody help me? If I have to change something in my classpath or path please tell me excatly according to the above directory sturture.

* Just for your information I have already set my CLASSPATH to .;C:\glueI; and my PATH variable is set to the directory where my javac file exsits.

Thanks.
Karc Origin

0
Comment
Question by:KarcOrigin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 3

Expert Comment

by:allahabad
ID: 7991476
Please do this;
C:\glueI>javac c:\glueI\corejavalib\DBAdapter.java

0
 
LVL 1

Expert Comment

by:membersh
ID: 7991502
You have 2 options
1. javac -d . DBCommond.java & then javac -d . DBAdapter.java

2. In command prompt, goto corejavalib directory, add '.' to CLASSPATH, then javac DB*.java

2nd option is suggested if all files in ur package starts with DB...
0
 
LVL 5

Author Comment

by:KarcOrigin
ID: 7991757
Dear allahabad and membersh I have tried your options but none of them works.

Anyways thank you very much. Keep the good work going on.

Karc Origin
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:msterjev
ID: 7991903
Try this:

package corejavalib;

public class DBAdapter
{
    DBCommond myC;

    public DBAdapter()
    {
       myC=new DBCommond();
    }


    public String getAdaptorName()
    {
         return "ORACLE";
    }
   
    public String getCommondTypeMode()
    {
         return myC.getCommondType();
    }
}




package corejavalib;

public class DBCommond
{
    public DBCommond(){}

    public String getCommondType()
    {
         return "INSERT";
    }
}
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 7992880
You don't need a classpath so:

C:\gluel>SET CLASSPATH=

then

C:\gluel>javac corejavalib\DBCommond.java

then

C:\gluel>javac corejavalib\DBAdapter.java

0
 

Expert Comment

by:CleanupPing
ID: 9059180
KarcOrigin:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 7

Expert Comment

by:tomboshell
ID: 9582087
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept CEHJ's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thomas Boshell
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 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