Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to compile and register a Java CFX tag with multiple class files?

Explorer ,
Aug 11, 2008 Aug 11, 2008
All-

If this is the wrong forum for CFX questions, please let me know.

I need to determine how to compile and register a Java CFX tag that contains multiple class files. One class file implements the CustomTag interface and the other class files implement various supporting classes. All of the documentation that I have found talks about using a single class file. I am assuming that a JAR file will be involved, but I am not sure of the specifics.

Thanks in advance for your help.

-Josh
TOPICS
Advanced techniques
782
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 11, 2008 Aug 11, 2008

Yes, it will involve a jar. Use your java IDE (eclipse, etcetera ..) to create a jar containing all of the classes. Check your ide's documentation for how to create jar files. After you have created the jar, place the jar in the CF class path so CF will recognize it. For example the {cf_root}/WEB-INF/lib directory. CF must be restarted before it will detect the new jar. After restarting CF, register the CFX tag in the ColdFusion Administrator using the name of the class that implements the CustomTag interface.

Though it is worth noting you can also instantiate java classes directly from ColdFusion (ie without using a CFX tag).
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 11, 2008 Aug 11, 2008
Thank you for your prompt reply. This is exactly the information I need.

Question: what are the pros/cons of providing (1) a CFX interface to Java-based functionality versus (2) a CFML interface (using direct Java class instantiation) to the same functionality?

-Josh
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 11, 2008 Aug 11, 2008
By calling Java direct you get much more control and can have Java Objects. Whereas with CFX you can really just utilise a Java Library that can do really defined tasks for you without getting the most out of the language.

As for Pros of CFX, the only real one that I can think of is that you are going to have more joy getting it deployed in a shared hosting as pretty much all of them are going to turn you down.

To summarise I have access to my own server so I only use Java Direct I haven't used CFX for about 4 years.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 11, 2008 Aug 11, 2008
quote:

Originally posted by: Stressed_Simon
As for Pros of CFX, the only real one that I can think of is that you are going to have more joy getting it deployed in a shared hosting as pretty much all of them are going to turn you down.


In this case, the CFX or CFML wrapper would be invoking Java classes provided by me. Are Java classes easier to deploy in a shared environment than a CFX would be?

-Josh
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 11, 2008 Aug 11, 2008
LATEST
Neither is easier it is just that you are more likely to persuade a host to let you deploy CFX tags in a shared environment than Java classes in the classpath. I am not sure but I think it is easier for them to restrict them with Sandbox Security.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources