diff options
author | Eliot Horowitz <eliot@10gen.com> | 2008-09-15 11:02:13 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2008-09-15 11:02:13 -0400 |
commit | db91183962d36d596157837a928217c411b84a7e (patch) | |
tree | 37fca5f88cd208492821751927870086e1b8fde8 /db/javajs.cpp | |
parent | 0627621e0076a3ced12aa02554d023fc84cac509 (diff) | |
download | mongo-db91183962d36d596157837a928217c411b84a7e.tar.gz |
classpath
Diffstat (limited to 'db/javajs.cpp')
-rw-r--r-- | db/javajs.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/db/javajs.cpp b/db/javajs.cpp index 9d4d558731b..dc9b6b38ab2 100644 --- a/db/javajs.cpp +++ b/db/javajs.cpp @@ -79,6 +79,26 @@ JavaJSImpl::JavaJSImpl() { JavaJSImpl(null); } +#if defined(_WIN32) +const char SYSTEM_COLON = ';'; +#else +const char SYSTEM_COLON = ':'; +#endif + + +void _addClassPath( const char * ed , stringstream & ss , const char * subdir ){ + path includeDir(ed); + includeDir /= subdir; + directory_iterator end; + directory_iterator i(includeDir); + while( i != end ) { + path p = *i; + ss << SYSTEM_COLON << p.string(); + i++; + } +} + + JavaJSImpl::JavaJSImpl(const char *appserverPath){ _jvm = 0; _mainEnv = 0; @@ -87,35 +107,21 @@ JavaJSImpl::JavaJSImpl(const char *appserverPath){ const char * ed = findEd(appserverPath); stringstream ss; -#if defined(_WIN32) - char colon = ';'; -#else - char colon = ':'; -#endif - ss << "-Djava.class.path=."; - ss << colon << ed << "/build/"; - - { - path includeDir(ed); - includeDir /= "include"; - directory_iterator end; - directory_iterator i(includeDir); - while( i != end ) { - path p = *i; - ss << colon << p.string(); - i++; - } - } + ss << SYSTEM_COLON << ed << "/build/"; + + _addClassPath( ed , ss , "include" ); + _addClassPath( ed , ss , "include/jython/" ); + _addClassPath( ed , ss , "include/jython/javalib" ); #if defined(_WIN32) - ss << colon << "C:\\Program Files\\Java\\jdk\\lib\\tools.jar"; + ss << SYSTEM_COLON << "C:\\Program Files\\Java\\jdk\\lib\\tools.jar"; #else - ss << colon << "/opt/java/lib/tools.jar"; + ss << SYSTEM_COLON << "/opt/java/lib/tools.jar"; #endif if( getenv( "CLASSPATH" ) ) - ss << colon << getenv( "CLASSPATH" ); + ss << SYSTEM_COLON << getenv( "CLASSPATH" ); string s = ss.str(); char * p = (char *)malloc( s.size() * 4 ); |