Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

java program launcher

Thread view: 
Hiker Hauk - 19 Feb 2006 10:12 GMT
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!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.