<?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>Developers, Developers, Developers!</title>
	<atom:link href="http://maksim.sorokin.dk/it/feed/" rel="self" type="application/rss+xml" />
	<link>http://maksim.sorokin.dk/it</link>
	<description>Maksim Sorokin IT Blog</description>
	<lastBuildDate>Wed, 01 Sep 2010 06:20:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Working with Windows Registry in Java 3</title>
		<link>http://maksim.sorokin.dk/it/2010/09/01/working-with-windows-registry-in-java-3/</link>
		<comments>http://maksim.sorokin.dk/it/2010/09/01/working-with-windows-registry-in-java-3/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 06:20:03 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[Windows registry]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=364</guid>
		<description><![CDATA[jRegistryKey library actually is under LGPL. So it is suitable to be used in commercial projects too! Very simple library, that just works!
]]></description>
			<content:encoded><![CDATA[<p><a href="http://sourceforge.net/projects/jregistrykey/">jRegistryKey</a> library actually is under LGPL. So it is suitable to be used in commercial projects too! Very simple library, that just works!</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/09/01/working-with-windows-registry-in-java-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maven Release Plugin &#8212; Difference Between &#8220;preparationGoals&#8221; and &#8220;goals&#8221; in configuration</title>
		<link>http://maksim.sorokin.dk/it/2010/08/31/maven-release-plugin-difference-between-preparationgoals-and-goals-in-configuration/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/31/maven-release-plugin-difference-between-preparationgoals-and-goals-in-configuration/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 19:50:13 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=360</guid>
		<description><![CDATA[Maven Release Plugin lets you release your project easily. However, often during release you want to perform some additional goals. For example, copy the artifact to another server.
There are several ways to do that. Among those is possibility to define goals during Maven release by adding goals or preparationGoals in configuration.
What is the difference between [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://maven.apache.org/plugins/maven-release-plugin/">Maven Release Plugin</a> lets you release your project easily. However, often during release you want to perform some additional goals. For example, copy the artifact to another server.</p>
<p>There are several ways to do that. Among those is possibility to define goals during Maven release by adding <a href="http://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html">goals</a> or <a href="http://maven.apache.org/plugins/maven-release-plugin/examples/run-goals-before-commit.html">preparationGoals</a> in configuration.</p>
<p>What is the difference between those? When you specify <code>goals</code>, you take over the deployment phase. I mean if you want to run some maven <code>task1</code> <code>task2</code> and then still continue deploying your released artifact to the repository, you need to specify the following:</p>
<pre>
  &lt;plugin&gt;
    &lt;artifactId&gt;maven-release-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.0&lt;/version&gt;
    &lt;configuration&gt;
      &lt;goals&gt;task1 task2 deploy&lt;/goals&gt;
    &lt;/configuration&gt;
  &lt;/plugin&gt;
</pre>
<p>But if you want to do some <em>additional</em> task, it is better to use <code>preparationGoals</code>. Released artifact anyway will be deployed to the repository, so you don't need to specify <code>deploy</code> explicitly.<br />
Moreover, <code>preprationGoals</code> are activated just before the commit.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/31/maven-release-plugin-difference-between-preparationgoals-and-goals-in-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Packt&#8217;s Open Source Awards 2010</title>
		<link>http://maksim.sorokin.dk/it/2010/08/30/packts-open-source-awards-2010/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/30/packts-open-source-awards-2010/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 21:10:12 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PACKT]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=371</guid>
		<description><![CDATA[Hey! Packt's Open Source Awards 2010 are coming!
]]></description>
			<content:encoded><![CDATA[<p>Hey! <a href="http://www.packtpub.com/open-source-awards-home">Packt's Open Source Awards 2010</a> are coming!</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/30/packts-open-source-awards-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Will Not Participate in JavaOne</title>
		<link>http://maksim.sorokin.dk/it/2010/08/29/google-will-not-participate-in-javaone/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/29/google-will-not-participate-in-javaone/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 07:54:28 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=374</guid>
		<description><![CDATA[http://googlecode.blogspot.com/2010/08/update-on-javaone.html
By Joshua Bloch
]]></description>
			<content:encoded><![CDATA[<p><a href="http://googlecode.blogspot.com/2010/08/update-on-javaone.html">http://googlecode.blogspot.com/2010/08/update-on-javaone.html</a><br />
By Joshua Bloch</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/29/google-will-not-participate-in-javaone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PACKT] Java EE 6 with GlassFish 3 Application Server</title>
		<link>http://maksim.sorokin.dk/it/2010/08/28/packt-java-ee-6-with-glassfish-3-application-server-2/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/28/packt-java-ee-6-with-glassfish-3-application-server-2/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 10:33:08 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[GlassFish]]></category>
		<category><![CDATA[Java EE 6]]></category>
		<category><![CDATA[PACKT]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=366</guid>
		<description><![CDATA[Java EE 6 with GlassFish 3 Application Server is another nice book from PACKT publishing.
It covers GlassFish administration. Then it talks about Java web technologies -- servlets, JSP, JSP STL, JSF. Also discusses database connections, Java Messaging Service, security of applications (you can find more about it in GlassFish Security book). The books also talks [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://maksim.sorokin.dk/it/wp-content/uploads/2010/08/java-ee-6-with-glassfish-3-application-server.jpg" alt="" width="300" height="225" class="alignleft size-full wp-image-367" /><a href="http://www.packtpub.com/java-ee-6-applications-with-glassfish-3-application-server/book?utm_source=maksim.sorokin.dk&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_004037">Java EE 6 with GlassFish 3 Application Server</a> is another nice book from PACKT publishing.</p>
<p>It covers GlassFish administration. Then it talks about Java web technologies -- servlets, JSP, JSP STL, JSF. Also discusses database connections, Java Messaging Service, security of applications (you can find more about it in <a href="http://maksim.sorokin.dk/it/2010/07/25/glassfish-security-packt/">GlassFish Security</a> book). The books also talks about EJBs and new possibilities in Java EE 6 -- contexts and dependency injection. In the last part it discusses JAX-WS and JAX-RS web services. And everything is accompanied with information how to do that with GlassFish application server.</p>
<p>I would very much recommend it to novice Java EE developers or just to developers, who want to have a glance on Java EE web technologies, JMS, Java EE 6 dependency injection, web services and how all that is configured in GlassFish application server. I would say, it is a crash course into Java EE.</p>
<p>The book is not covering each section is deep detail. But gives a broad view on different Java EE possibilities.</p>
<p>The book is full of working examples! What I very much like about it, is that it not only talks about the latest Java EE 6 technologies. But also briefly covers how application can be configured in order to work with older standards.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/28/packt-java-ee-6-with-glassfish-3-application-server-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Working with Windows Registry in Java 2</title>
		<link>http://maksim.sorokin.dk/it/2010/08/27/working-with-windows-registry-in-java-2/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/27/working-with-windows-registry-in-java-2/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 10:37:08 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Windows registry]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=352</guid>
		<description><![CDATA[Ok, so the way to read registry data, which I described in previous post may be not a good idea. It is safer to rely on Windows Reg command. I wrote a simple utility to query registry using that utility.

isExists finds whereas registry path exists
get gets the value for specific key on certain registry path



import [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so the way to read registry data, which I described in <a href="http://maksim.sorokin.dk/it/2010/08/24/working-with-windows-registry-in-java/">previous post</a> may be not a good idea. It is safer to rely on <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/reg.mspx">Windows Reg</a> command. I wrote a simple utility to query registry using that utility.</p>
<ul>
<li><code>isExists</code> finds whereas registry path exists</li>
<li><code>get</code> gets the value for specific key on certain registry path</li>
</ul>
<p><span id="more-352"></span></p>
<pre>
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class WindowsRegistry {

  public static boolean isExists(WindowsRegistryRootKey rootKey, String registryPath) throws Exception {
    return (getOutput(rootKey, registryPath).size() &gt; 0);
  }

  public static String get(WindowsRegistryRootKey rootKey, String registryPath, String key) throws Exception {
    List output = getOutput(rootKey, registryPath, key);

    return (getValueFromOutput(output));
  }

  static List getOutput(WindowsRegistryRootKey rootKey, String registryPath) throws Exception {
    if ((rootKey == null) || (registryPath == null)) {
      return new ArrayList();
    }

    String command = String.format("reg query \"%s\\%s\"", rootKey.getRootKey(), registryPath);

    return execRegQuery(command);
  }

  public static List getOutput(WindowsRegistryRootKey rootKey, String registryPath, String key) throws Exception {
    if ((rootKey == null) || (registryPath == null) || (key == null)) {
      return new ArrayList();
    }

    String command = String.format("reg query \"%s\\%s\" /v %s", rootKey.getRootKey(), registryPath, key);

    return execRegQuery(command);
  }

  private static List execRegQuery(String command) throws Exception {
    List result = new ArrayList();

    Process process = Runtime.getRuntime().exec(command);

    InputStreamReader isr = new InputStreamReader(process.getInputStream());
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null) {
      result.add(line);
    }

    return result;
  }

  static String getValueFromOutput(List output) {
    for (String line : output) {
      String[] chunks = line.split("    ");
      if (isChunksValid(chunks)) {
        return chunks[3];
      }
    }

    return null;
  }

  private static boolean isChunksValid(String[] chunks) {
    if ((chunks.length != 4) || (chunks[0].trim().length() != 0)) {
      return false;
    }

    for (int i = 1; i &lt; chunks.length; i++) {
      String chunk = chunks[i];
      if (chunk.trim().length() == 0) {
        return false;
      }
    }

    return true;
  }
}
</pre>
<pre>
public enum WindowsRegistryRootKey {

  HKEY_LOCAL_MACHINE("HKLM");

  private String rootKey;

  WindowsRegistryRootKey(String rootKey) {
    this.rootKey = rootKey;
  }

  String getRootKey() {
    return rootKey;
  }
}
</pre>
<p>And tests!</p>
<pre>
import java.util.ArrayList;
import java.util.List;

import org.junit.Assert;
import org.junit.Test;

public class WindowsRegistryTest {

  @Test
  public void testIsExists_doesntExist() throws Exception {
    Assert.assertFalse(WindowsRegistry.isExists(WindowsRegistryRootKey.HKEY_LOCAL_MACHINE, "a"));
  }

  @Test
  public void testIsExists() throws Exception {
    Assert.assertTrue(WindowsRegistry.isExists(WindowsRegistryRootKey.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion"));
  }

  @Test
  public void testGetOutput_passNull1() throws Exception {
    Assert.assertEquals(0, WindowsRegistry.getOutput(null, "a").size());
  }

  @Test
  public void testGetOutput_passNull2() throws Exception {
    Assert.assertEquals(0, WindowsRegistry.getOutput(WindowsRegistryRootKey.HKEY_LOCAL_MACHINE, null).size());
  }

  @Test
  public void testGetOutput_passNullBoth() throws Exception {
    Assert.assertEquals(0, WindowsRegistry.getOutput(null, null).size());
  }

  @Test
  public void testGetOutput2_passNull1() throws Exception {
    Assert.assertEquals(0, WindowsRegistry.getOutput(null, "a", "b").size());
  }

  @Test
  public void testGetOutput2_passNull2() throws Exception {
    Assert.assertEquals(0, WindowsRegistry.getOutput(WindowsRegistryRootKey.HKEY_LOCAL_MACHINE, "a", null).size());
  }

  @Test
  public void testGetOutput2_passNull3() throws Exception {
    Assert.assertEquals(0, WindowsRegistry.getOutput(WindowsRegistryRootKey.HKEY_LOCAL_MACHINE, null, "b").size());
  }

  @Test
  public void testGetOutput2_passNullAll() throws Exception {
    Assert.assertEquals(0, WindowsRegistry.getOutput(null, null, null).size());
  }

  @Test
  public void testGetValueFromOutput_noValid() throws Exception {
    List output = new ArrayList();
    output.add("HKEY");

    Assert.assertNull(WindowsRegistry.getValueFromOutput(output));
  }

  @Test
  public void testGetValueFromOutput() throws Exception {
    List output = new ArrayList();
    output.add("                              ");
    output.add("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
    output.add("    ProductName    REG_SZ    Windows 7 Professional");

    Assert.assertEquals("Windows 7 Professional", WindowsRegistry.getValueFromOutput(output));
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/27/working-with-windows-registry-in-java-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy Files with SCP Using Maven</title>
		<link>http://maksim.sorokin.dk/it/2010/08/26/copy-files-with-scp-using-maven/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/26/copy-files-with-scp-using-maven/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 16:10:05 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[SCP]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=350</guid>
		<description><![CDATA[You can use Maven AntRun Plugin and Ant SCP task in order to transfer files with SCP:

...
  &#60;build&#62;
    ...
    &#60;plugins&#62;
    ...
      &#60;plugin&#62;
        &#60;artifactId&#62;maven-antrun-plugin&#60;/artifactId&#62;
        &#60;configuration&#62;
   [...]]]></description>
			<content:encoded><![CDATA[<p>You can use <a href="http://maven.apache.org/plugins/maven-antrun-plugin/">Maven AntRun Plugin</a> and <a href="http://ant.apache.org/manual/Tasks/scp.html">Ant SCP</a> task in order to transfer files with SCP:<span id="more-350"></span></p>
<pre>
...
  &lt;build&gt;
    ...
    &lt;plugins&gt;
    ...
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
          &lt;tasks&gt;
            &lt;scp todir="${scp.user}:${scp.password}@${scp.host}:/${scp.dirCopyTo}" trust="true" failonerror="false"&gt;
              &lt;fileset dir="${bundle.dir}" /&gt;
            &lt;/scp&gt;
          &lt;/tasks&gt;
        &lt;/configuration&gt;
        &lt;dependencies&gt;
          &lt;dependency&gt;
            &lt;groupId&gt;ant&lt;/groupId&gt;
            &lt;artifactId&gt;ant-jsch&lt;/artifactId&gt;
            &lt;version&gt;1.6.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
            &lt;groupId&gt;com.jcraft&lt;/groupId&gt;
            &lt;artifactId&gt;jsch&lt;/artifactId&gt;
            &lt;version&gt;0.1.42&lt;/version&gt;
          &lt;/dependency&gt;
        &lt;/dependencies&gt;
      &lt;/plugin&gt;
...
</pre>
<p>Alternatively, you can use <a href="http://ant.apache.org/manual/Tasks/sshexec.html">Ant sshexec</a> command in order to do additional stuff through SSH, like create or remove folders.</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/26/copy-files-with-scp-using-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Obfuscated Signed Java Web Start Applications with Maven</title>
		<link>http://maksim.sorokin.dk/it/2010/08/25/building-obfuscated-signed-java-web-start-applications-with-maven/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/25/building-obfuscated-signed-java-web-start-applications-with-maven/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 06:33:07 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java Web Start]]></category>
		<category><![CDATA[JNLP]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[obfuscation]]></category>
		<category><![CDATA[ProGuard]]></category>
		<category><![CDATA[signing]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=347</guid>
		<description><![CDATA[I have Java Web Start application with several libraries, some of which I want to obfuscate before the release. Unfortunately, I cannot use Webstart Maven Plugin since it works correctly only when all the dependencies, which will be assembled, are already present in the repository. In my case, I want to obfuscate libraries on-the-fly, sign [...]]]></description>
			<content:encoded><![CDATA[<p>I have Java Web Start application with several libraries, some of which I want to obfuscate before the release. Unfortunately, I cannot use <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/">Webstart Maven Plugin</a> since it works correctly only when all the dependencies, which will be assembled, are already present in the repository. In my case, I want to obfuscate libraries on-the-fly, sign them, put into zip file and deploy to my repository.</p>
<p>Instead, I attach the following chain of plugins to maven build lifecycle:</p>
<ol>
<li>Download keystore (refer to <a href="http://maksim.sorokin.dk/it/2010/08/19/signing-jars-on-a-build-server/">my older post</a></li>
<li>Download all dependencies (except ones, which I will obfuscate) with <a href="http://maven.apache.org/plugins/maven-dependency-plugin/">Maven Dependency Plugin</a></li>
<li>Run ProGuard on needed jars with <a href="http://pyx4me.com/pyx4me-maven-plugins/proguard-maven-plugin/">Maven ProGuard Plugin</a></li>
<li>Sign all the jars with <a href="http://maven.apache.org/plugins/maven-jarsigner-plugin/">Maven Jarsigner Plugin</a></li>
<li>Filter JNLP file with <a href="http://maven.apache.org/plugins/maven-resources-plugin/">Maven Resources Plugin</a></li>
<li>Assemble application with <a href="http://maven.apache.org/plugins/maven-assembly-plugin/">Maven Assembly Plugin</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/25/building-obfuscated-signed-java-web-start-applications-with-maven/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Working with Windows Registry in Java</title>
		<link>http://maksim.sorokin.dk/it/2010/08/24/working-with-windows-registry-in-java/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/24/working-with-windows-registry-in-java/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 16:00:29 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=343</guid>
		<description><![CDATA[There are commercial and free libraries which enable a possibility to work with Windows registry from Java. For example, there is nice, simple, free, but old jRegistryKey library. The problem is that it is gpl and works with additional dll file. It is under LGPL.
However, we can read and write to Windows Registry without additional [...]]]></description>
			<content:encoded><![CDATA[<p>There are commercial and free libraries which enable a possibility to work with Windows registry from Java. For example, there is nice, simple, free, but old <a href="http://sourceforge.net/projects/jregistrykey/">jRegistryKey</a> library. <del datetime="2010-08-28T10:14:04+00:00">The problem is that it is gpl and works with additional dll file.</del> It is under LGPL.</p>
<p>However, we can read and write to Windows Registry without additional libraries and any sort of JNI. First, check out this:<br />
<a href="http://dmi.ensica.fr/doc/Java/j2sdk-1_4_2-doc/docs/j2h/java/util/prefs/WindowsPreferences.java.html">http://dmi.ensica.fr/doc/Java/j2sdk-1_4_2-doc/docs/j2h/java/util/prefs/WindowsPreferences.java.html</a><br />
And here are some examples how guys work with that:<br />
<a href="http://www.davidc.net/programming/java/reading-windows-registry-java-without-jni">http://www.davidc.net/programming/java/reading-windows-registry-java-without-jni</a><br />
<a href="http://www.jroller.com/lenkite/entry/use_pure_java_to_access">http://www.jroller.com/lenkite/entry/use_pure_java_to_access</a><br />
A bit hacky and works only with <code>REG_SZ</code>. But often that is enough!</p>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/24/working-with-windows-registry-in-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Obfuscating Several Jars in One Single Maven Build with ProGuard</title>
		<link>http://maksim.sorokin.dk/it/2010/08/23/obfuscating-several-jars-in-one-single-maven-build-with-proguard/</link>
		<comments>http://maksim.sorokin.dk/it/2010/08/23/obfuscating-several-jars-in-one-single-maven-build-with-proguard/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 15:42:00 +0000</pubDate>
		<dc:creator>Maksim Sorokin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[obfuscation]]></category>
		<category><![CDATA[ProGuard]]></category>

		<guid isPermaLink="false">http://maksim.sorokin.dk/it/?p=339</guid>
		<description><![CDATA[ProGuard is nice and free tool for obfuscating your code. Actually, it can do a lot more: shrink, optimize and verify your application. But here we will stick solely on obfuscating several jars in one build with ProGuard and Maven.
There are some documentation on ProGuard Maven Plugin website, something on Stack Overflow and ofcourse in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://proguard.sourceforge.net/">ProGuard</a> is nice and free tool for obfuscating your code. Actually, it can do a lot more: shrink, optimize and verify your application. But here we will stick solely on obfuscating <em>several</em> jars in one build with ProGuard and Maven.</p>
<p>There are some documentation on <a>ProGuard Maven Plugin</a> website, <a href="http://stackoverflow.com/questions/880839/maven-proguard-and-assembly-issues">something on Stack Overflow</a> and ofcourse in <a href="http://proguard.sourceforge.net/">official documentation</a>.</p>
<p>Say, you have a complex Java Web Start application consisting of several modules. And you want to obfuscate each module before release. Of course, you do not want to obfuscate for internal usage, but want to do it only before release. What you can do is to use<span id="more-339"></span> <a href="http://mojo.codehaus.org/webstart/webstart-maven-plugin/">Webstart Maven Plugin</a> to assemble and sign the application. But before running it, you will obfuscate it with <a>ProGuard Maven Plugin</a>.</p>
<p>Now, the question is. How do you obfuscate several jars separately? The solution is pretty simple and based on <a href="http://article.gmane.org/gmane.comp.java.maven-plugins.mojo.user/1307">old trick</a>. You can have several different executions, but with <em>different</em> <code>id</code>s, each outputting obfuscate application to a different jar. For example:</p>
<pre>
...
  &lt;build&gt;
    ...
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;com.pyx4me&lt;/groupId&gt;
        &lt;artifactId&gt;proguard-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.0.4&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;first&lt;/id&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;proguard&lt;/goal&gt;
            &lt;/goals&gt;

            &lt;configuration&gt;
              &lt;outjar&gt;first.jar&lt;/outjar&gt;
              &lt;options&gt;
                &lt;option&gt;-keep public class dk.sorokin.maksim.first.Hello1 { public static void main(java.lang.String[]); }&lt;/option&gt;
              &lt;/options&gt;
              &lt;assembly&gt;
                &lt;inclusions&gt;
                  &lt;inclusion&gt;
                    &lt;groupId&gt;dk.sorokin.maksim&lt;/groupId&gt;
                    &lt;artifactId&gt;first&lt;/artifactId&gt;
                  &lt;/inclusion&gt;
                &lt;/inclusions&gt;
              &lt;/assembly&gt;
              &lt;libs&gt;
                &lt;lib&gt;${java.home}/lib/rt.jar&lt;/lib&gt;
                &lt;lib&gt;${java.home}/lib/javaws.jar&lt;/lib&gt;
              &lt;/libs&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;

          &lt;execution&gt;
            &lt;id&gt;aaa&lt;/id&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;proguard&lt;/goal&gt;
            &lt;/goals&gt;

            &lt;configuration&gt;
              &lt;outjar&gt;second.jar&lt;/outjar&gt;
              &lt;options&gt;
                &lt;option&gt;-keep public class dk.sorokin.maksim.second.Hello2 { public String sayHello(); }&lt;/option&gt;
              &lt;/options&gt;
              &lt;assembly&gt;
                &lt;inclusions&gt;
                  &lt;inclusion&gt;
                    &lt;groupId&gt;dk.sorokin.maksim&lt;/groupId&gt;
                    &lt;artifactId&gt;second&lt;/artifactId&gt;
                  &lt;/inclusion&gt;
                &lt;/inclusions&gt;
              &lt;/assembly&gt;
              &lt;libs&gt;
                &lt;lib&gt;${java.home}/lib/rt.jar&lt;/lib&gt;
                &lt;lib&gt;${java.home}/lib/javaws.jar&lt;/lib&gt;
              &lt;/libs&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
	  ....
</pre>
]]></content:encoded>
			<wfw:commentRss>http://maksim.sorokin.dk/it/2010/08/23/obfuscating-several-jars-in-one-single-maven-build-with-proguard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
