This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi All. Just when I thought I had it all figured out... My directory structure(s) for two concurrent releases are as follows... /home/myself/Release1/a/b/c //lets call this dir1 /home/myself/Release2/a/b/c // dir2 My CLASSPATH points to /home/myself/Release1 All java files in both directories (dir1 & dir2) have a package statement at the beginning of the file as follows :- package a.b.c; The question --> If I go to the dir2 & try to compile a file, say myFile.java, Why is it compiling ??? It should not compile since my CLASSPATH is pointing to Release1 & not Release2. Just to be sure that the myFile.java file that was getting compiled was in the Release 2 and not Release 1, I checked the timestamps of the myFile.class file & it was current in the dir2 & old in dir1. Any ideas whats going on ?? How is the Javac able to fine the Release2 code even when the CLASSPATH only points to Release 1 ??? thanks in advance...
Since you have all the required files already present in the classpath /home/myself/Release1, when you compile the file present in release2, it looks for the necessary files in the classpath and since they are present in Release1 in the classpath, it uses them to compile your file in Release2. Remove the Release1 from your directory and it will not compile, unless all your files are not present in the current directory. Hope it helps, thanks, Preetham.
Joined: Aug 01, 2001
Thanks for your response... I renamed Release1 to Release1_hj. The file in Release2 still compiled fine. When I compile a standalone (which does not need any other file in the package) file in Release 2, it does not refer to release 1 files, in anyway. Moreover, as I said before, the timestamp on the class file of this file is current, which means that it was this file (in release2) that was compiled and not the same file in Release1. Any guesses on whats going on ?
Himanshu, Here's a couple of suggestions.... 1. I've noted a reference to a posting I made at the Ranch concerning classpaths which may help you out (maybe it'll shed some light): Java Ranch discussion re: classpath 2. It may be best to sort of dissect this into smaller pieces, i.e.-move your program which uses the package into an entirely different directory and move the package source code into a 2nd entirely different directory. Modify your classpath for the new locate where you placed your package. Rename your compiled class files, Then try your compiles. Take the next step and actually try to run the code. Consider also how you are trying to compile your code - using the -d option? etc. Hopefully this will help you solve your mystery. Good luck! Janet
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com