Hi there,
I want to know how to write a java program launcher for Windows.
It's a .exe file to laucher a java program. Just like the one Azureus
use.
Basically, it equals command "java classname", but when looking at the
process tree, you'll see the difference.
I think it's easy to implement for people who're familiar with Win32
programming.
Could someone tell me how to do it or send me a sample program.
Thanks in advance.
Roedy Green - 19 Feb 2006 11:18 GMT
>I want to know how to write a java program launcher for Windows.
>
>It's a .exe file to laucher a java program. Just like the one Azureus
>use.
see http://mindprod.com/jgloss/kicker.html
http://mindprod.com/jgloss/installer.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Madroadie - 19 Feb 2006 17:55 GMT
Here is the basic app Launcher. The rest is up to you
DWORD LaunchApp(LPCTSTR szCmdLine, LPCTSTR szWorkingDir, bool bWait)
{
DWORD dwRetVal, dwCreationFlags;
STARTUPINFO sInfo;
PROCESS_INFORMATION pInfo;
dwCreationFlags = CREATE_NO_WINDOW;
ZeroMemory( &sInfo,sizeof( STARTUPINFO ) );
sInfo.cb = sizeof( STARTUPINFO );
BOOL bRet = ::CreateProcess( NULL,
(LPTSTR)(LPCTSTR)szCmdLine,
NULL,
NULL,
FALSE,
dwCreationFlags,
NULL,
szWorkingDir,
&sInfo,
&pInfo );
if (bWait)
{
WaitForSingleObject( (HANDLE)pInfo.hProcess, INFINITE );
GetExitCodeProcess( (HANDLE)pInfo.hProcess, &dwRetVal );
}
else
dwRetVal = 0;
return dwRetVal;
}
> Hi there,
>
[quoted text clipped - 12 lines]
>
> Thanks in advance.
weiss.matt@gmail.com - 19 Feb 2006 19:10 GMT
Check out JSmooth... http://jsmooth.sourceforge.net/
Red Orchid - 19 Feb 2006 21:43 GMT
"Hiker Hauk" <hikerhauk@gmail.com> wrote or quoted in
Message-ID: <1140343945.664558.51020@g43g2000cwa.googlegroups.com>:
> I want to know how to write a java program launcher for Windows.
Maybe .. it is as like.
<code>
(This is not tested)
int APIENTRY _tWinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow) {
STARTUPINFO si;
memset(&si, 0, sizeof(si));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi = {0};
BOOL b = CreateProcess (
NULL,
"javaw.exe -jar -your option your file.jar",
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&si,
&pi );
if (!b) {
return -1;
}
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return 0;
}
</code>
Thomas Kellerer - 19 Feb 2006 22:05 GMT
Hiker Hauk wrote on 19.02.2006 11:12:
> Hi there,
>
[quoted text clipped - 10 lines]
>
> Could someone tell me how to do it or send me a sample program.
The JDK sources do include the sources for the java.exe launcher which is
exactly what you want.
Thomas
Hiker Hauk - 20 Feb 2006 06:19 GMT
Thank you all. Merci beaucoup!