File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "To Check the Source file" Watch "To Check the Source file" New topic

To Check the Source file

vitthal wable

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

Joined: Jul 08, 2003
Posts: 24199

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 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


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.
I agree. Here's the link:
subject: To Check the Source file
It's not a secret anymore!