• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

packages

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have an application that have 3 packages. I am supposed to be able to compile each package alone?
I deleted all the classes and recompiled them.
I am got errors that said it need specific classes from the two other packages...
Does this mean that I should put all the files that needs each other in the same one?
thank you
/Daniela
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You compile programs (.java), not packages. Anyway, you need probably need to import classes that are in other packages:
import package1.*;
import package2.*;
Moving this to Java in General (Beginner)
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, the compiler will need to be able to locate the other packages through the CLASSPATH setting when compiling.
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I allready have all the imports I need to compile, and I have allready set the classpath.
I dont get compilation errors when I dont erase the .classes
When I remove all the .class and want to recompile everything, I have to follow an order :
Compile class B.java in packageB to be able to compile class A.java in packageA wich also need class C.java in packageC etc...
I can not compile one package at the time...
Is this bad?
/Daniela
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is not bad...because when you compiled package A(depends on Package B)the compiler looks for the required .class files in package B and since u removed all of them it throws errors....so its basically u r not instructing it correctly. you can solve this in two ways :
Compile the packages in the order of dependencies or compile all the files
together in a single command *.java
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ah ok, thank you Arvind...
do you know the javac arguments to compile all java file in subdirectories?
 
reply
    Bookmark Topic Watch Topic
  • New Topic