File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes To Check the Source file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "To Check the Source file" Watch "To Check the Source file" New topic
Author

To Check the Source file

vitthal wable
Greenhorn

Joined: Sep 09, 2006
Posts: 16
hii Friends,
Here I want to know that ; suppose i have .java file and after compilation class file is generated for .java file In this case suppose i want to check that whether java file is changed after compilation, I know that there is command for java Interpreter but i forget it if anyone is aware of that please reply
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Check whether the Java file is changed? Check what?

Maybe you mean check whether the Java file is newer than the class file? You'd just use the operating system's last modified time for the two files. If you're doing this in Java, the java.io.File class has a method to check this; otherwise, "ls -l" or "dir" will do the trick.


[Jess in Action][AskingGoodQuestions]
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257

Hello,

Exactly. That what ANT will do. It checks the time stamp .class file with .java file. if the timestamps are diffe then new compilation for that file will be made.

if some one make touch of the .class file then .... ? it recompiles again.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: To Check the Source file