I need to use my own java class in a cfml page.
This entry in the documentation sounds great but does not explain which files I have to create.
I tried to
a TestClass.java + TestClass.class in the same path.
You cannot just place .class files anywhere. When the CF server starts, it only checks specific locations for classes/jars. Those locations are referred to as the "CF class path". Your compiled .class file must be placed within the CF class path, or it will not be detected.
To use a custom java class:
YourTestClass.javaYourTestClass.classPlace the compiled .class file somewhere within the CF classpath, such as:
WEB-INF\classes - for individual .class filesWEB-INF\lib - for .jar files (multiple classes)Note: You could also add the item to the CF class path via the ColdFusion Administrator. However, placing the class in one of the default directories is simpler.
Restart the ColdFusion server so it detects the new classes
Note: Though you can use individual .class files, it is more common to package them into .jar files.