Results 1 to 2 of 2
  1. #1
    Annorax is offline Member
    Join Date
    Apr 2010
    Posts
    1
    Rep Power
    0

    Question Compiling all modified Java files in a folder on Unix

    Hi all,

    I have a Unix script that will compile all Java files in a sub folder as follows:

    find . -name "*.java" -print -exec $JAVA_HOME/bin/javac -cp .:$CLASSPATH '{}' \;

    I would like to enhance it to only compile those Java files who:

    1.) Have no class file
    2.) Have a class file modified in the past.

    Could someone please assist me with this? Thanks for any help.

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by Annorax View Post
    Hi all,

    I have a Unix script that will compile all Java files in a sub folder as follows:

    find . -name "*.java" -print -exec $JAVA_HOME/bin/javac -cp .:$CLASSPATH '{}' \;

    I would like to enhance it to only compile those Java files who:

    1.) Have no class file
    2.) Have a class file modified in the past.

    Could someone please assist me with this? Thanks for any help.

    for 1.) i would create a list with all source-files and compare if for each source file also a class-file exists. for 2.) you want to know if the source-file has been modified after compilation? i don't think this is possible if you don't have a history for the specified file. but perhaps i misunderstand your requirement.

Similar Threads

  1. Selecting Files in a folder
    By ravjot28 in forum New To Java
    Replies: 1
    Last Post: 02-26-2010, 04:25 PM
  2. Compiling Multiple Files
    By Chasingxsuns in forum New To Java
    Replies: 4
    Last Post: 02-12-2010, 01:22 PM
  3. Replies: 2
    Last Post: 02-20-2009, 07:13 AM
  4. Placing Files In Folder
    By ramesh.8189 in forum New To Java
    Replies: 0
    Last Post: 02-06-2009, 12:36 PM
  5. How to Extract EAR files in UNIX
    By RG18173 in forum Advanced Java
    Replies: 6
    Last Post: 12-12-2008, 08:21 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
  •