<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>What I Learned Today &#187; advancedinstaller</title>
	<atom:link href="http://christiansons.net/mike/blog/tag/advancedinstaller/feed/" rel="self" type="application/rss+xml" />
	<link>http://christiansons.net/mike/blog</link>
	<description>Mike Christianson&#039;s journal of Java, Ant, SVN, Jetty, cygwin and other stuff.</description>
	<lastBuildDate>Wed, 04 Aug 2010 22:24:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Use Advanced Installer licensing within a Java application</title>
		<link>http://christiansons.net/mike/blog/2009/02/use-advanced-installer-licensing-within-a-java-application/</link>
		<comments>http://christiansons.net/mike/blog/2009/02/use-advanced-installer-licensing-within-a-java-application/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 03:31:34 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[advancedinstaller]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=108</guid>
		<description><![CDATA[Advanced Installer 6.7 has a new licensing and registration feature which allows for time-limited demos/trials and registration of installed software. Caphyon, the maker of Advanced Installer, provides code samples and documentation on licensing integration for C++ and C# applications. To use this feature, the application must make a call into an Advanced Installer library and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.advancedinstaller.com/"><img alt="" src="http://www.caphyon.com/img/index/biglogo_ai.gif" title="Advanced Installer" class="alignleft" width="69" height="99" /></a>Advanced Installer 6.7 has a <a href="http://www.advancedinstaller.com/user-guide/licensing.html">new licensing and registration feature</a> which allows for time-limited demos/trials and registration of installed software.</p>
<p>Caphyon, the maker of Advanced Installer, provides code samples and <a href="http://www.advancedinstaller.com/user-guide/qat-trial.html">documentation on licensing integration</a> for C++ and C# applications.  To use this feature, the application must make a call into an Advanced Installer library and handle its return code.  </p>
<p>The library is a gatekeeper to the rest of the application, effectively deciding whether or not the application is allowed to run.  It determines the software&#8217;s trial status and displays a registration dialog, terminates the application, or returns a code, accordingly.  The Java implementation of this feature works a little differently.</p>
<p>For those using the <a href="http://www.advancedinstaller.com/user-guide/native-java-launcher.html">Java Launcher</a>, integrating the licensing feature is easy: simply add the Java Product on the <a href="http://www.advancedinstaller.com/user-guide/licensing-settings.html">Licensing Options</a> tab.  But, what about those who don&#8217;t use Java Launcher?  Or those that wish to enable users to register from within the application?</p>
<p>There is no official documentation which answers these questions, but based on a discussion following a <a href="http://www.advancedinstaller.com/forums/viewtopic.php?f=2&#038;t=8538">request for help I posted on the Advanced Installer forums</a>, I was able integrate AI&#8217;s licensing feature into my Java application without using the Java Launcher.<span id="more-108"></span></p>
<p>My solution mirrors the C++ implementation and is remarkably simple.  Thanks to Cosmin, a member of the Advanced Installer support team, for sending me in the right direction.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LicenseChecker <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> LIBRARY_KEY <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Replace this String with the Trialware/Registration Library Key&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> args<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> TrialLibrary.<span style="color: #006633;">INSTANCE</span>.<span style="color: #006633;">ReadSettingsStr</span><span style="color: #009900;">&#40;</span>LIBRARY_KEY, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//http://www.advancedinstaller.com/user-guide/qa-trial-using.html</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">:</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Thank you for registering this program.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">:</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Thank you for trying this program.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Program will continue.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// ...</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">interface</span> TrialLibrary <span style="color: #000000; font-weight: bold;">extends</span> Library <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">final</span> TrialLibrary INSTANCE <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TrialLibrary<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">Native</span>.<span style="color: #006633;">loadLibrary</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Trial&quot;</span>, TrialLibrary.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// loads Trial.dll</span>
        <span style="color: #000066; font-weight: bold;">int</span> ReadSettingsStr<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> keyCode, HWND hwnd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">int</span> DisplayRegistrationStr<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> keyCode, HWND hwnd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Note: The above uses <a href="https://jna.dev.java.net/">Java Native Access (JNA)</a> to invoke the Advanced Installer library.</p>
]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/02/use-advanced-installer-licensing-within-a-java-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automate Advanced Installer with Ant</title>
		<link>http://christiansons.net/mike/blog/2009/01/automate-advanced-installer-with-ant/</link>
		<comments>http://christiansons.net/mike/blog/2009/01/automate-advanced-installer-with-ant/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 05:04:13 +0000</pubDate>
		<dc:creator>Mike Christianson</dc:creator>
				<category><![CDATA[ant]]></category>
		<category><![CDATA[advancedinstaller]]></category>
		<category><![CDATA[automation]]></category>

		<guid isPermaLink="false">http://blog.christiansons.net/?p=106</guid>
		<description><![CDATA[Note: this post was updated in light of discussion on the Advanced Installer forum. At work, we use Advanced Installer to create easy-to-use Windows installers for internal and external customers. I wrote a short Ant script for building the installer to save time and minimize mistakes. If you use Advanced Installer with your Java projects, [...]]]></description>
			<content:encoded><![CDATA[<p>Note: this post was updated in light of <a href="http://www.advancedinstaller.com/forums/viewtopic.php?f=2&#038;t=8586">discussion on the Advanced Installer forum</a>.</p>
<p>At work, we use <a href="http://www.advancedinstaller.com/">Advanced Installer</a> to create easy-to-use Windows installers for internal and external customers.  I wrote a short Ant script for building the installer to save time and minimize mistakes.</p>
<p style="border: thin dashed;">
<em>If you use Advanced Installer with your Java projects, be sure to read my post on <a href="http://christiansons.net/2009/02/use-advanced-installer-licensing-within-a-java-application/">using the Advanced Installer licensing feature within a Java application</a>.</em>
</p>
<p>Here is a partial Ant script for executing Advanced Installer builds.  It&#8217;s not fancy, but it gets the job done.<span id="more-106"></span>  Notice the script has two parts &#8212; one for setting the version number of the product and another for doing the actual build.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;installer.command&quot;</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;C:/Caphyon/Advanced Installer/AdvancedInstaller.com&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;filename&quot;</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;C:/build/product.aip&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;${installer.command}&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;/edit&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${filename}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;/SetVersion&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${installerVersion}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;${installer.command}&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;/build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${filename}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>In the next snippet, which should be executed first, I&#8217;ve made the version number dynamic based on the current time, day, and month (but not year)!  (The pattern may seem a little odd; it conforms to <a href="http://msdn.microsoft.com/en-us/library/aa370859.aspx">what Windows Installer expects</a>.)  Of course, this is completely optional and can be overridden using <a href="http://ant.apache.org/manual/running.html">Ant command-line properties</a>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tstamp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;format</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;installerVersion&quot;</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;MM.dd.HHmm&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tstamp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>When this script is combined with continuous integration, we have a repeatable, consistent, fully automated build of our software and its installer.  And that rocks.</p>
]]></content:encoded>
			<wfw:commentRss>http://christiansons.net/mike/blog/2009/01/automate-advanced-installer-with-ant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
