Java classpath

There's something that can make your life easier, and that thing is java classpath.

Standalone package structure looks like this:

<br />&#9500;&#9472;&#9472; 3rd-party-licenses<br />&#9500;&#9472;&#9472; harvest.sh<br />&#9500;&#9472;&#9472; libs<br />&#9500;&#9472;&#9472; license.txt<br />&#9500;&#9472;&#9472; logalpha.properties<br />&#9500;&#9472;&#9472; mon<br />&#9500;&#9472;&#9472; ncc<br />&#9500;&#9472;&#9472; nis<br />&#9500;&#9472;&#9472; nix.logalpha.properties<br />&#9500;&#9472;&#9472; nix.runMon.sh<br />&#9500;&#9472;&#9472; nix.runNcc.sh<br />&#9500;&#9472;&#9472; nix.runNis.sh<br />&#9500;&#9472;&#9472; README.txt<br />&#9500;&#9472;&#9472; runMon.bat<br />&#9500;&#9472;&#9472; runNcc.bat<br />&#9492;&#9472;&#9472; runNis.bat<br />

let's assume you've installed it in [tt]c:\crypto\nem[/tt]

If you take a look at runNis it looks as follows:
<br />pushd nis<br />java -Xms512M -Xmx1G -cp &quot;.;./*;../libs/*&quot; org.nem.core.deploy.CommonStarter<br />popd nis<br />

It means classpath is (in order - keep in mind that [tt]pushd[/tt] changes directory) :


    [li]. - current dir (c:\crypto\nem\nis) - this actually is most important part as it causes nis to load config.properties from this dir[/li]
    [li]./ - files in current dir (nis jar in c:\crypto\nem\nis)[/li]
    [li]…/libc/ - dependencies, libs dir (c:\crypto\nem\libs)[/li]


    Now, you can actually copy config.properties and db.properties into some other dir, so for example in [tt]c:\crypto\super-nem[/tt]
    than in super-nem you need to unpack standalone package, so your strucure looks as follow:

    <br />[code]<br />&#9500;&#9472;&#9472; config.properties<br />&#9500;&#9472;&#9472; db.properties<br />&#9500;&#9472;&#9472; logalpha.properties<br />&#9492;&#9472;&#9472; nem<br />&nbsp; &nbsp; &#9500;&#9472;&#9472; ...<br />&nbsp; &nbsp; &#9500;&#9472;&#9472; mon<br />&nbsp; &nbsp; &#9500;&#9472;&#9472; ncc<br />&nbsp; &nbsp; &#9500;&#9472;&#9472; nis<br />&nbsp; &nbsp; &#9492;&#9472;&#9472; ...<br />

    you'll also need to create your own start script, example for NIS:

    <br />pushd nem/nis<br />java -Xms512M -Xmx1G -cp &quot;../..;./*;../libs/*&quot; org.nem.core.deploy.CommonStarter<br />popd<br />

    Java searches classpath in order, so the above means, config.properties will be read from your main dir (c:\crypto\super-nem),
    and nis will be started inside nem/nis.

    That means you can easily create environment, where you only need to unpack standalone, and you won't have to change config.properties manually.

More about…Java Classpath

Anto