ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 26th, 2012, 04:59 PM
ColdBreeze ColdBreeze is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 29 ColdBreeze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 56 m
Reputation Power: 0
Loading Java JAR's in CF10

I'm trying to load the Docx4j JAR file. But I keep getting a class not found... even though I specified where the JAR is located in the Application.cfc:

Code:
<cfcomponent output="false">

	<cfset this.javaSettings =
		{LoadPaths = ["/myJava/lib"], loadColdFusionClassPath = true, reloadOnChange= true, 
		watchInterval = 100, watchExtensions = "jar,class,xml"} />

</cfcomponent>


EDIT:

http://www.docx4java.org/trac/docx4j

When dealing with JAR's I am guessing we use dot notation to transverse and find the class that we need?

This doesn't work:

Code:
<cfset docObj = createObject("java","org.docx4j.openpackaging.packages.WordprocessingMLPackage") />

Reply With Quote
  #2  
Old May 29th, 2012, 06:42 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
Yes, that's the right syntax. You'll need to be sure the method exists, that you're passing any required parameters into the constructor (if there are any constructor args), and that they are of the proper Java type.

I actually haven't tried the new class loader in CF 10 though.

Reply With Quote
  #3  
Old May 29th, 2012, 06:43 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
You might try specifying an absolute path to the library folder to make sure it's pointing where you think it should be.

Reply With Quote
  #4  
Old May 30th, 2012, 11:30 PM
ColdBreeze ColdBreeze is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 29 ColdBreeze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 56 m
Reputation Power: 0
Ah, I got it to work now. These objects require the init() constructor to be supplied to them.

Code:
<cfset docObj = createObject("java","org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart").init() />
<cfset docPackageObj = createObject("java","org.docx4j.openpackaging.packages.WordprocessingMLPackage").init() />


This is actually, very good news since it is telling me that CF10 can actually work around class loading issues.

Reply With Quote
  #5  
Old May 30th, 2012, 11:48 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
This has actually been available for a while as an open-source add on called JavaLoader. Adobe just realized it was very useful and incorporated it with some modifications.

Reply With Quote
  #6  
Old June 4th, 2012, 09:16 PM
cfSearching cfSearching is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 117 cfSearching User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 16 m 2 sec
Reputation Power: 6
Quote:
Originally Posted by kiteless
This has actually been available for a while as an open-source add on called JavaLoader. Adobe just realized it was very useful and incorporated it with some modifications.


Do you know what modifications were made or where to find the official documentation on this feature? I was curious how it differs from the javaLoader, but my google must be broken because I am coming up with zip... ;-)

Reply With Quote
  #7  
Old June 5th, 2012, 12:51 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
I'm actually not sure. I don't think it was anything major though, just tighter integration with CF (obviously, heh).

Reply With Quote
  #8  
Old June 5th, 2012, 08:24 AM
cfSearching cfSearching is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 117 cfSearching User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 16 m 2 sec
Reputation Power: 6
Yeah, Mark Mandel must be so proud

Finally found some documentation on it here:
http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-106e125d1353e804331-7ffe.html

Reply With Quote
  #9  
Old June 5th, 2012, 08:48 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
I know Mark pretty well and he's actually not super thrilled about having all that work appropriated heh. Ah, the perils of open source.

Reply With Quote
  #10  
Old June 5th, 2012, 09:41 AM
cfSearching cfSearching is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 117 cfSearching User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 16 m 2 sec
Reputation Power: 6
Quote:
Originally Posted by kiteless
I know Mark pretty well and he's actually not super thrilled about having all that work appropriated heh. Ah, the perils of open source.


Having used every one of the javaLoader's incarnations, I do not blame him. It is a fantastic piece of work. (If you could hear my tone, the "proud" comment was injected with a wealth of sarcasm

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Loading Java JAR's in CF10

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap