Index: /release-kits/shared/search4j/compile.sh
===================================================================
--- /release-kits/shared/search4j/compile.sh	(revision 15103)
+++ /release-kits/shared/search4j/compile.sh	(revision 15103)
@@ -0,0 +1,1 @@
+g++ search4j.cpp -o search4j
Index: /release-kits/shared/search4j/search4j.cpp
===================================================================
--- /release-kits/shared/search4j/search4j.cpp	(revision 15102)
+++ /release-kits/shared/search4j/search4j.cpp	(revision 15103)
@@ -7,9 +7,11 @@
 #include <iostream>
 #include <fstream>
+#include <string>
 #include <sstream>
-#include <string>
+
+using namespace std;
+
+#ifdef WINDOWS
 #include <windows.h>
-using namespace std;
-
 
 //minimal launch4j stuff
@@ -20,4 +22,9 @@
 char foundJavaVer[128] = {0};
 
+//windows functions
+#define popen _popen
+#define strcmp _stricmp
+#endif /* WINDOWS */
+
 
 //global variables
@@ -50,5 +57,5 @@
 int process( string command, string &output ) {
 	
-	FILE   *pPipe;
+	FILE *pPipe;
 
 	/* Run command so that it writes its output to a pipe. Open this
@@ -57,9 +64,19 @@
 	char cmd[1024]; strcpy(cmd, command.c_str());
 	//if ( verbose ) cout << "process(): running '" << command << "'" << endl;
-	if( (pPipe = _popen( cmd, "rt" )) == NULL ) {
+	#ifdef WINDOWS
+	if( (pPipe = popen( cmd, "rt" )) == NULL ) {
 		if ( verbose ) cout << "could not start process" << endl;
-		_pclose( pPipe );
+		pclose( pPipe );
 		return -1;
 	}
+	#endif
+	#ifndef WINDOWS
+	if( (pPipe = popen( cmd, "r" )) == NULL ) {
+		if ( verbose ) cout << "could not start process" << endl;
+		pclose( pPipe );
+		return -1;
+	}
+	#endif
+
 	//if ( verbose ) cout << "started process" << endl;
 
@@ -80,5 +97,5 @@
 
 	/* Close pipe and return return value of pPipe. */
-	int code = _pclose( pPipe );
+	int code = pclose( pPipe );
 	return code;
 }
@@ -116,5 +133,13 @@
 		string exec = "";
 		exec.append( javaHome );
+		
+		#ifdef WINDOWS
 		exec.append( "\\bin\\java.exe" );
+		#endif
+
+		#ifndef WINDOWS
+		exec.append( "/bin/java" );
+		#endif
+		
 		return exec;
 	}
@@ -181,7 +206,9 @@
 		command.append( "\"" );
 		command.append(" -version 2>&1");
+		//cout << "(command: " << command << ")";
 		int result = process( command, output );
+		//cout << "(output: " << output << ")";
 		if ( result == 0 ) {
-			if ( _stricmp( output.substr( 0, 12 ).c_str() , "java version" ) == 0 || true ) {
+			if ( strcmp( output.substr( 0, 12 ).c_str() , "java version" ) == 0 || true ) {
 				era = atoi( output.substr(14,1).c_str() );
 				major = atoi( output.substr(16,1).c_str() );
@@ -265,5 +292,5 @@
 Jvm minimum;
 
-
+#ifdef WINDOWS
 void regSearch(HKEY hKey, const char* keyName, int searchType) {
 	DWORD x = 0;
@@ -285,5 +312,5 @@
 	}
 }
-
+#endif
 
 /*
@@ -303,4 +330,5 @@
 		javaHome = getenv( "JAVA_HOME" );
 		if ( javaHome != NULL ) {
+			if ( verbose ) cout << "(" << javaHome << ")";
 			jvm.setJavaHome( javaHome );
 			if ( jvm.check() ) {
@@ -322,4 +350,5 @@
 		javaHome = getenv( "JRE_HOME" );
 		if ( javaHome != NULL ) {
+			if ( verbose ) cout << "(" << javaHome << ")";
 			jvm.setJavaHome( javaHome );
 			if ( jvm.check() ) {
@@ -335,5 +364,6 @@
 		if ( verbose ) { if( jvmFound ) cout << "yes" << endl; else cout << "no" << endl; }
 	}
-	
+
+	#ifdef WINDOWS
 	if ( !jvmFound ) {
 		//try the registry - this code based on launch4j code
@@ -391,4 +421,5 @@
 		if ( verbose ) { if( jvmFound ) cout << "yes" << endl; else cout << "no" << endl; }
 	}
+	#endif
 
 	return jvmFound;
@@ -409,14 +440,14 @@
 	//parse commandline arguments
 	for (int i=1; i<argc; i++) {
-		if ( _stricmp(argv[i], "--verbose") == 0 ) {
+		if ( strcmp(argv[i], "--verbose") == 0 ) {
 			verbose = true;
-		} else if ( _stricmp(argv[i], "--help") == 0 || _stricmp(argv[i], "--usage") == 0 ) {
+		} else if ( strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "--usage") == 0 ) {
 			usage();
 			return 0;
-		} else if ( _stricmp(argv[i], "-v") == 0 ) {
+		} else if ( strcmp(argv[i], "-v") == 0 ) {
 			jvmProperty = Version;
-		} else if ( _stricmp(argv[i], "-e") == 0 ) {
+		} else if ( strcmp(argv[i], "-e") == 0 ) {
 			jvmProperty = Executable;
-		} else if ( _stricmp(argv[i], "-c") == 0 ) {
+		} else if ( strcmp(argv[i], "-c") == 0 ) {
 			action = Compare;
 			if ( i == argc-1 ) {
@@ -427,5 +458,5 @@
 			}
 
-			} else if ( _stricmp(argv[i], "-m") == 0 ) {
+			} else if ( strcmp(argv[i], "-m") == 0 ) {
 			if ( i == argc-1 ) {
 				usage();
@@ -439,5 +470,5 @@
 			}
 
-		} else if ( _stricmp(argv[i], "-l") == 0 ) {
+		} else if ( strcmp(argv[i], "-l") == 0 ) {
 			action = Launch;
 			arg1 = argv[++i];
@@ -521,2 +552,3 @@
 	return 0;
 }
+
