• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help in package/class path !

 
mamata mahapatra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have DataConverter.java file in package suncertify.db.Converter. I
am trying to access Data class from package suncertify.db. It is
giving compilation error "class suncertify.db.Data not found in
import".
what should be my classpath?
My current classpath is d:\jdk1.2
\jre\lib\rt.jar;d:\;d:\javadeveloper\Scjd2\starting\;%CLASSPATH%;
path=d:\jdk1.2\bin;d:\jdk1.2\lib;
I am using windows NT server on my pc.
I would appreciate any input on this.
thanks,
mamata.
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to compile the file? If you are, then you need the output option. javac -d xxx file.java
 
srilatha malip
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just look at ur directory structure, whether it's matching ur package structure. If u've any other directories above suncertify, then set the classpath upto that directory. For example if u have suncertify directory in java directory, set ur classpath to java directory. I hope this helps,
Srilatha.
 
mamata mahapatra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srilatha,
Thanks for your reply. I did that. I moved my suncertify directory to javadeveloper1 and changed the classpath to d:\javadeveloper1;
DataConverter.java is in package suncertify.db.converter; I imported "import suncertify.db.Data;" in the file DataConverter.java.
Still It is giving the same problem"package suncertify.db.Data not found in import"
I would appreciate your response.
Thanks,
mamata.
 
srilatha malip
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mamata,
I checked it on my system. It's not giving any errors. Just before compiling the converter class give the following command and compile ur file while ur in the same directory where ur javaprogram is.
java -classpath d:\javadeveloper\scjd\starting
if ur suncertify directory is in d:\javadeveloper\scjd\starting directory.
srilatha.
 
srilatha malip
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mamata,
Are u still getting errors after giving java -classpath command?
thanks,
srilatha.
 
Arunagiri, Shanmugham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It is very simple to set the package. If your Data class is in suncertify.db.Converter then check the following
1. DataConverter file should have package suncertify.db.Converter
2. And the DataConverter should be in a directory structure of
<parent directory>\suncertify\db\Converter\<Data class>.
3. Classpath should be set for <parent directory>.
That's it.
Arun
 
Arunagiri, Shanmugham
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It is very simple to set the package. If your Data class is in suncertify.db.Converter then check the following
1. DataConverter file should have package suncertify.db.Converter
2. And the DataConverter should be in a directory structure of
"parent directory"\suncertify\db\Converter\"Data class".
3. Classpath should be set for "parent directory".
That's it.
Arun
 
mamata mahapatra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot guy's. Now I am able to compile and run the program successfully. I set the classpath D:\javadeveloper\Scjd2\starting;
Compiled javac suncertify\db\converter\DataConverter.java in the directory d:\javadeveloper\Scjd2\starting.
Runned the program java suncertify\db\converter\DataConverter.java in the same directory.
Thanks a lot again.
regds,
mamata.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic