• Post Reply Bookmark Topic Watch Topic
  • New Topic

compilation problem  RSS feed

 
prachi jahagirdar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to compile some java files which uses the object of some other class. For example, i have two directories 'comm' and 'b'. i am trying to compile the java files in directory 'b' which uses the files in 'comm' directory.
I " don't " want to import the package of 'comm', but i want the java files in 'b' should get compiled without error. the files in 'b' do not conatain error. but every time i compile it. it gives me some object is missing(which is in 'comm'). how do i do it?
please help me with this
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
package seet1;
public class aa
{public void aab()
{ System.out.println("AAAAAAAA");
}
}
package seet2;
public class bb
{public void bbbb()
{System.out.println("BBBBBBBBBBBBBBBB");
}
}
public class cc
{public static void main(String args[])
{seet1.aa aa1= new seet1.aa();
aa1.aab();
System.out.println("in AAA");
seet2.bb bb1 = new seet2.bb();
bb1.bbbb();
System.out.println("in BBBB");
}
}
HTH,
Seetesh
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you are having a problem with your CLASSPATH. Make sure that the parent directory of your "comm" and "b" directories is in the CLASSPATH. For example, if your directory structure looks like this:
...
MyProject
\--src
|--comm
|--b
then make sure MyProject/src is in your CLASSPATH. This also assumes that your classes are declared in packages, e.g. "package comm;" appears in all of your comm classes and "package b;" appears in all of your b classes.
 
prachi jahagirdar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the answers.
What I have stated down is possible
when we give command as
javac -classpath \MyProject\src\comm \Myproject\src\b\test.java
then does the '-classpath' calls the setclasspath and sets the path to the specified directory. If yes then is previously set path gets reset?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!