This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

compilation problem  RSS feed

 
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
 
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
 
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!