Results 1 to 5 of 5
  1. #1
    bender0101 is offline Member
    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Default Recompiling .java file on source changes

    Hi folks,

    Are all files in package will be recompiled if I change one of public classes in package? Is this true if I change class with "package access" visibility (declares without any access modifiers, just "class ClassName {...}")?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: Recompiling .java file on source changes

    No, just the ones actually used in whatever class you're compiling AND only if they need recompiling.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    bender0101 is offline Member
    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Default Re: Recompiling .java file on source changes

    Thank your for quick response!

    Could you please post a link with rules of recompilation process or clarify cases when they need recompiling? My usecase is: one public class and some with package access visibility within the same .java file:
    Java Code:
    public class Base {}
    class Derived1 extends Base {}
    class Derived2 extends Base {}
    class Factory
    {
    static Base create() {}
    }
    If I change Derived1, which classes will be recompiled?

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: Recompiling .java file on source changes

    Think about what you're asking here man, it makes no sense at all to even ask it at all. All these classes are in the exact same source file.

    How would it be possible to NOT compile any of them, since you compile source files and not individual classes inside a source file? The documentation you seek is any beginner book on Java, chapter 1 or 2 depending on where the book talks about the basics of the basics.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    bender0101 is offline Member
    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Default Re: Recompiling .java file on source changes

    Thanks, I see.

    So, if I modify Derived1 and use it nowhere in the package (just within this file), no other files in the package will be recompiled?

Similar Threads

  1. How to get Translateable Strings form java source file
    By tahir.pucit.pk@gmail.com in forum Advanced Java
    Replies: 3
    Last Post: 07-17-2012, 05:42 AM
  2. Replies: 7
    Last Post: 08-29-2011, 07:35 PM
  3. Get source code from java file
    By rjagan in forum New To Java
    Replies: 1
    Last Post: 04-04-2011, 11:51 AM
  4. Java source code for Dividing a file
    By LOKESHWARI in forum Advanced Java
    Replies: 2
    Last Post: 10-14-2010, 04:27 PM
  5. Replies: 0
    Last Post: 01-29-2009, 11:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •