See my entry of 8/24/02 for important updated information and a new precompile.bat file
You may know that CFMX now compiles templates into Java classes. You may also have noticed that this means the first user to run a template after it’s created or changed will suffer a small hit (up to a couple seconds) while it’s compiled the first time.
You can help alleviate that wait by pre-compiling one or more templates. To do so, you’d want to create a file called, for instance, precompile.bat, with the following lines:
set MX_INSTALL=c:\cfusionMX
set PATH=%MX_INSTALL%\runtime\bin;%PATH%
java -classpath %MX_INSTALL%\lib\cfusion.jar
coldfusion.tools.Compiler -webroot
%MX_INSTALL%\wwwroot %*
(That should just be 3 lines in our batch file, 2 starting with "set" and one starting with "java".)
Save it in your
Precompile mydir
If this command is successful, you’ll see a display indicating that it’s compiling each file, one at a time, and reporting how long it takes to compile. Very nifty!
If you’re not familiar with getting to the DOS command prompt, or running .bat files from a specific directory, seek help from someone with that knowledge. It’s important, to use the command in the way I’ve described, that you place this file in the
Note that if you want to precompile all the files in the entire wwwroot, you can use the command:
Precompile .
This tells it to compile the current directory (as indicated by the “.”), and it will automatically search all the subdirectories as well. Beware of this option, as this will also compile the CFDOCS and CFIDE directories that come with CFMX. That’s over 2000 files, not counting your own! (And the tool doesn’t know to skip files it’s already compiled.)
A final important note is that without some extra work, this trick will only work if you are storing your CFMX templates in the
No comments:
Post a Comment