Q4/2009

2009-12-21 Did you ever had the need to use a command line (program plus parameters) when only an executable can be specified?
Well, I had the need. And unfortunately a batch file did not work either. I needed run a java program with plenty parameters, but the application accepted only a single *.exe.

My solution: I invented a simple exe stub, where you append the command line (using echo). This results into an executable which invokes you command line.
Download cmd2exe.zip and try it yourself.
2009-11-21 SFTP4TC 1.3.60.8 is out with minor fixes-
Minor bug fix: changed behaviour for links back.
2009-11-21 SFTP4TC 1.3.60.7 is out and provides unicode support.
The used translation is performed based on PuTTY's translation character set.
2009-11-17 released BNM 0.0.5 and its Eclipse integration plugin
just a minor update for BNM.
2009-11-12 released BNM 0.0.4 and its Eclipse integration plugin
BNM is not Maven.
BNM is rather a prof of possible enhancements to Maven.
Since I wrote BNM and it works ways faster than Maven, I switched from Maven to BNM.

So the next logical step is to enhance BNM. Version 0.0.4 provides minor enhancements needed for the new BNM Eclipse integration. So the main feature is the Eclipse integrataion. Read more at http://www.bebbosoft.de/java/bnm/
2009-11-01 Ever needed to change the uid or gid from Java?
Updated the code and added a reasonable return code.
If you consider to run a server application written in Java which listens on a port below 1024 then you have few choices. My favorite is still the patch to allow also all members in group 1 to open such ports. But if you can't touch the kernel, you often end with running the Java application as root.

This is not what you always want.

Another solution is to change group and user id after the initial work is done. For this purpose you need a JNI library and the matching Java class.

GUID.java:
package de.bb.unix;

/**
 * Helper class to change the uid and gid.
 * @author Stefan Bebbo Franke
 */
public class GUID {
  static {
    System.loadLibrary("de-bb-unix-guid");
  }
  public native static boolean setGUID(int uid, int gid);
} 

guid.cpp:
#include <unistd.h>
#include <jni.h>

extern "C" jboolean JNICALL Java_de_bb_unix_GUID_setGUID(JNIEnv* env, jclass clazz, jint uid, jint gid) {
  if (gid) setregid(gid, gid);
  if (uid) setreuid(uid, uid);
  return (!gid || gid == getegid()) && (!uid || uid == geteuid());
} 

and the command how to create the shared library:
g++ -shared -static -lc -I /usr/lib/jvm/java-1.6.0-openjdk/include/ \
    -I /usr/lib/jvm/java-1.6.0-openjdk/include/linux guid.cpp -o libde-bb-unix-guid.so

or

gcc -fPIC -shared -I /usr/lib/jvm/java-1.7.0-openjdk.x86_64/include/ \
    -I /usr/lib/jvm/java-1.7.0-openjdk.x86_64/include/linux/ guid.cpp -o libde-bb-unix-guid.so


Remember that you cannot change your uid back to root!

You can also download it here.
2009-10-24 released SFTP for TotalCMD (SFTP4TC): 1.3.60.5
Version 1.3.60.5 provides the major feature to support INI files in addition to the registry. Also some bug fixes went into it. Check it out at berlios.de

Since the SFTP4TC download link at berlios seems to be slow you may also use this download link: wfx_sftp_1_3_60_5_base_bin.zip

rev: 1.4