Skip to content

Commit

Permalink
WOStart
Browse files Browse the repository at this point in the history
 Java 8 support
 bugfixes
  • Loading branch information
markusstoll committed Apr 24, 2014
1 parent b4f7d5f commit 3aac18b
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 24 deletions.
13 changes: 13 additions & 0 deletions Utilities/WOStart/CompileScripts/compile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set OLDDIR=%CD%
cd %~dp0
cd ..

c:\MSys\bin\sh --login %~dp0\make32.sh
copy WOStart.exe WOStart.32.exe

c:\MSys\bin\sh --login %~dp0\make64.sh
copy WOStart.exe WOStart.64.exe

c:\MSys\bin\sh --login %~dp0\makeclean.sh

cd %OLDDIR%
7 changes: 7 additions & 0 deletions Utilities/WOStart/CompileScripts/make32.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
. /bin/win-builds-switch.sh 32

cd `dirname $0`
cd ..

make clean
make
7 changes: 7 additions & 0 deletions Utilities/WOStart/CompileScripts/make64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
. /bin/win-builds-switch.sh 64

cd `dirname $0`
cd ..

make clean
make
4 changes: 4 additions & 0 deletions Utilities/WOStart/CompileScripts/makeclean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cd `dirname $0`
cd ..

make clean
6 changes: 3 additions & 3 deletions Utilities/WOStart/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include make.config

WOStart${EXESUFFIX}: java.o java_md.o manifest_info.o WOStart.o
${CC} ${CFLAGS} -o ${WINEDITION}/WOStart${EXESUFFIX} *.o ${LIBS}
strip ${WINEDITION}/WOStart${EXESUFFIX}
${CC} ${CFLAGS} -o WOStart${EXESUFFIX} *.o ${LIBS}
strip WOStart${EXESUFFIX}

.c.o:
${CC} ${CFLAGS} -c $<
Expand All @@ -11,4 +11,4 @@ WOStart${EXESUFFIX}: java.o java_md.o manifest_info.o WOStart.o
${CC} ${CFLAGS} -c $<

clean:
rm *.o
rm *.o WOStart.exe
7 changes: 3 additions & 4 deletions Utilities/WOStart/ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ Using this has some advandages
- No problems due to classpath length

As with java.exe the current VM is read from registry. For now, this works
up to Java7.
up to Java8.



- Compiling

Makefile and make.config are prepared for compiling using Mingw32 and Mingw64
under windows (for mingw64 you might have to create a symbolic link using
"ln -s x86_64-w64-mingw32-strip.exe strip.exe").
Makefile and make.config are prepared for compiling using Mingw (32 and 64 Bit)
under windows.
To get it compiled with Mingw under Linux you might have to tweak make.config
a little bit.

Expand Down
43 changes: 37 additions & 6 deletions Utilities/WOStart/WOStart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ string getNextRoot();
string getNextLocal();

#define APPNAME "WOStart"
#define VERSION "1.0"
#define VERSION "1.1"

extern "C" {
int Java_Main(int argc, char ** argv, char *javaCommand);
Expand All @@ -28,10 +28,10 @@ string g_currentDirectory;
string g_appRoot;

// Path to WebObjects installation
string g_WORoot(getNextRoot());
string g_WORoot;

// Path to WebObjects Local directory
string g_localRoot(getNextLocal());
string g_localRoot;

// Path to Home Root (what does this mean in this context?)
string g_homeRoot("C:\\");
Expand All @@ -45,6 +45,8 @@ string g_jvmCommand("java");
// JVM options
string g_jvmOptions("");

static bool debugoutput = false;

// Report fatal error and exit
//
void fatalError(char *message) {
Expand Down Expand Up @@ -116,6 +118,7 @@ string getNextRoot() {
{
DWORD bufLen = _MAX_PATH;
char buf[_MAX_PATH];
buf[0] = 0;

RegQueryValueEx(hKey, "NEXT_ROOT", NULL, NULL,
(LPBYTE) buf, &bufLen);
Expand All @@ -124,8 +127,12 @@ string getNextRoot() {
normalisePath(root);
}

if (root.length() > 0)
if (root.length() > 0) {
if (debugoutput) {
cout << "WORoot found in Registry: " << root.c_str() << endl;
}
return root;
}

// cerr << "Warning: Unable to locate WOROOT/NEXT_ROOT using registry" << endl;

Expand Down Expand Up @@ -168,6 +175,10 @@ string getNextRoot() {
DWORD fattr = GetFileAttributes(root.c_str());
if (fattr != INVALID_FILE_ATTRIBUTES &&
fattr & FILE_ATTRIBUTE_DIRECTORY) {
if (debugoutput) {
cout << "WORoot found on drive: " << root.c_str() << endl;
}

return root;
}

Expand Down Expand Up @@ -438,6 +449,14 @@ int wostart_main(int argc, TCHAR* argv[])
// tell the world about ourselves;
cout << APPNAME << " " << VERSION << endl;

if (getenv("_JAVA_LAUNCHER_DEBUG") != 0) {
debugoutput = true;
}

g_WORoot = getNextRoot();
g_localRoot = getNextLocal();


// where are we being launched from?
g_currentDirectory = getAppDirectory();

Expand All @@ -457,9 +476,21 @@ int wostart_main(int argc, TCHAR* argv[])
int js = jargs.size();
char *new_argv[1000];

cout << "Arguments" << endl;
//
// remove suffixes from command (remove .32.exe, .64.exe, .exe)
//
cout << "Command" << endl;
string command = argv[0];
size_t found = command.find('.');
if(found != string::npos) {
string substr = command.substr(0, found);
command.assign(substr);
}

new_argv[0] = argv[0];
new_argv[0] = (char *)command.c_str();
cout << " " << new_argv[0] << endl;

cout << "Arguments" << endl;
int ii;
for(ii=0; ii < js; ii++)
{
Expand Down
11 changes: 7 additions & 4 deletions Utilities/WOStart/java_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,10 @@ WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
* Helpers to look in the registry for a public JRE.
*/
/* Same for 1.5.0, 1.5.1, 1.5.2 etc. */
#define DOTRELEASE "1.5"
#define DOTRELEASE5 "1.5"
#define DOTRELEASE6 "1.6"
#define DOTRELEASE7 "1.7"
#define DOTRELEASE8 "1.8"
#define JRE_KEY "Software\\JavaSoft\\Java Runtime Environment"

static jboolean
Expand Down Expand Up @@ -281,11 +282,13 @@ GetPublicJREHome(char *buf, jint bufsize)
return JNI_FALSE;
}

if (strcmp(version, DOTRELEASE) != 0 &&
if (strcmp(version, DOTRELEASE5) != 0 &&
strcmp(version, DOTRELEASE6) != 0 &&
strcmp(version, DOTRELEASE7) != 0) {
strcmp(version, DOTRELEASE7) != 0 &&
strcmp(version, DOTRELEASE8) != 0)
{
fprintf(stderr, "Registry key '" JRE_KEY "\\CurrentVersion'\nhas "
"value '%s', but '" DOTRELEASE "' or '" DOTRELEASE6 "' or '" DOTRELEASE7 "' is required.\n", version);
"value '%s', but '" DOTRELEASE5 "' upto '" DOTRELEASE8 "' is required.\n", version);
RegCloseKey(key);
return JNI_FALSE;
}
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 6 additions & 7 deletions Utilities/WOStart/make.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ CC = gcc

GCCTARGET = $(shell bash -c '${CC} -dumpmachine')

ifeq "${GCCTARGET}" "mingw32"
WINEDITION = win32
CFLAGS = -I/C/Program\ Files\ \(x86\)/Java/jdk1.5.0_14/include -I/C/Program\ Files\ \(x86\)/Java/jdk1.5.0_14/include/win32 -L./
EXESUFFIX = .exe

ifeq "${GCCTARGET}" "i686-w64-mingw32"
LIBS = -lz32 -lstdc++ -static
else
WINEDITION = win64
LIBS = -lz64 -lstdc++ -static
endif

CFLAGS = -I/C/Program\ Files\ \(x86\)/Java/jdk1.5.0_14/include -I/C/Program\ Files\ \(x86\)/Java/jdk1.5.0_14/include/win32 -L${WINEDITION}
LIBS = -lz -lstdc++ -static
EXESUFFIX = .exe

0 comments on commit 3aac18b

Please sign in to comment.