Re: Confused about how packages work.



On 29 Jan 2006 21:37:58 -0800, JoshRountree@xxxxxxxxx wrote, quoted or
indirectly quoted someone who said :

>
>When I compile MyTest.java with javac MyTest.java in the directory
>where both are located why does it say it cannot find MyOtherTest.java

The practical solution to your problem is to say:

javac *.java

and be done with it let Javac sort it out. This is what you have to do
to deal with circular references anyway.

It probably makes it worse that your classes are not public.

The solution you will eventually home in on is using ant scripts to do
your builds. Then you let ant worry about it.

It is tricky figuring out when Javac will compile or recompile classes
other than the ones you explicitly asked it to compile. I have found
that relying on Java to do that nearly always leads to trouble,
especially when you have mixed -target specifications.. I explicitly
compile the library packages first then client packages, always a
whole package at a pop, always using ANT, which does it every so much
more quickly than you can from the command line loading javac.exe over
and over.

See http://mindprod.com/jgloss/javacexe.html
http://mindprod.com/jgloss/ant.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.



Relevant Pages

  • Re: Dealing with packages UNIX
    ... Everything has the same package name in teh same directory. ... ALso when my web app runs it is using an older version of the class file taht wont compile even afer I did a rm *.class and replaced them with the javac *.java. ... javac needs a defined sourcepath to work. ...
    (comp.lang.java.programmer)
  • Re: More info about this strange compile error
    ... > I get compile error when compiling using the command javac from the ... > Then I do javac HelloWorld.java ... > symbol: class Slask ... > location: class HelloWorld ...
    (comp.lang.java)
  • Compiler incompatibility?
    ... I am trying to compile a Java class, Foo, that has a dependency on another ... Java class, Bar. ... What do I need to do to make Foo and Bar play nicely together? ...
    (comp.lang.java.programmer)
  • Re: dependency-detection in java - Take 2
    ... cause compile errors could ... still be made to be properly propagated to all dependent classes. ... If javac were to add an attribute to the .class-file (containing "source" ... then third party tools (like e.g. ant) would have the necessary data ...
    (comp.lang.java.programmer)
  • Re: java packages
    ... Using the following to compile manually. ... javac -classpath %PROD_CLASSPATH% CSDSMsg.java javac -classpath %PROD_CLASSPATH% DBS.java javac -classpath %PROD_CLASSPATH% RunDBS.java javac -classpath %PROD_CLASSPATH% XSS.java ... Common Java package name nomenclature is to use all ... The source and class files are to all be in same directory DBS_Intercept ...
    (comp.lang.java.programmer)