Tuesday, March 22, 2016

Am I running as Administrator in a Windows batch file

Am I running as Administrator in a Windows batch file

This is a great way to test:

whoami /groups | findstr /b BUILTIN\Administrators | findstr /c:"Enabled group" && GOTO RunningAsAdmin
ECHO This must be run as AdministratorGOTO NotRunningAsAdmin
:RunningAsAdmin


Monday, March 14, 2016

Maven antrun java.io.IOException: "Cannot run program" because "The filename or extension is too long"

There is an issue on where the command that maven antrun fails to run a java because the command line is too long.
In my case the classpath was way too long.

To fix it the classpath needs to be written to a manifest in a jar file and that needs to be used by java to get the classpath.

Here is an example of how to do it:


<manifestclasspath property="manifest.classpath"
                   jarfile="target/classpathSupplier.jar"
                   maxParentLevels="99">
    <classpath refid="maven.compile.classpath" />
</manifestclasspath>
<!-- Create pathing Jar --><jar destfile="target/classpathSupplier.jar">
    <manifest>
        <attribute name="Class-Path" value="${manifest.classpath}"/>
    </manifest>
</jar>
<java classname="org.me.ClassToRun" fork="yes" failonerror="true">
    <arg value="-someArg" />
    <!--<jvmarg value="-Xdebug"/>-->
    <!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
    <classpath>
        <pathelement location="target/classpathSupplier.jar"/>
    </classpath>
</java>

Thursday, March 3, 2016

Windows password expiry and complexity, disabling

To disable Windows Password expire date and lower complexity, go to:
( This is good to do on VMs used for testing, that only occasionally run )


  1. Control Panel
  2. Administrative Tools
  3. Local Security Policy
  4. Account Policies
  5. Password Policy
Set Maximum password age to 0
Set Password complexity to Disabled.