Creating Packages
Was wondering if any of you could help us with the creation of packages in java.
The steps we are following are as follows:-
1) include the statement
package projecta;
in the class Information
2)At the command prompt we gave:
javac -d . Information.java
3) import projecta.*;
to another class RandomAccessRecord
4)At the command prompt we gave
javac RandomAccessRecord.java
It says cannot find package projecta.Information. We have our source code in c:\j2sdk1.4.2_05. Doing step 1, created a package projecta in c:\j2sdk1.4.2_05. Do we have to set some classpath?
-Thanks
[659 byte] By [
ansa628] at [2007-9-30 18:52:38]

Sure ,U MUST set the class path.
For example if u r class file is in directory Y whic is af subolder of X. And ur class file lest say Example.class is in Y.
U can run it either by using java Y.Example [\b] after switching to the directory X Or set the class path to
(ex) c:\X and now u run it using java Y.Example .But remember u must always run it using java Y.Example
and not java Example.
Hope this will solve the issue.
Sure ,U MUST set the class path.
For example if u r class file is in directory Y whic is af subolder of X. And ur class file lest say Example.class is in Y.
U can run it either by using java Y.Example after switching to the directory X Or set the class path to
(ex) c:\X and now u run it using java Y.Example .But remember u must always run it using java Y.Example
and not java Example.
Hope this will solve the issue.