Re: launching application in Windows without DOS command window
Frank Ziglar <[email protected]>
| Newsgroups | gmane.org.user-groups.trijug.juglist |
|---|---|
| Message-ID | <[email protected]> |
There is perhaps a simpler approach, if you are interested. You can make a shortcut directly to your javaw.exe, then provide the necessary arguments in the "target" field for the shortcut itself. Eg: Target: "C:\Program Files\java150\bin\javaw.exe" -cp "junit.jar;myproject\classes" -ea junit.awtui.TestRunner will launch JUnit, without creating a DOS command window and without needing a batch file. Of course, the "start minimized" will now apply to your application's first window, so you'll probably want to set that to normal. Hope this helps! -Frank At 12:06 PM 9/10/2005, you wrote: >Thank you for the suggestions. I've found an acceptable way to >start a Java application on Windows, without using or displaying a >DOS command window. The only drawback is a brief flash of a taskbar button. > >Here I will describe the way I've found. My platform is Java 5 on >Windows 2000. > >STEP: > >0. Verify a javaw command, that can launch your application from the >command prompt. > >1. Create a batch file which contains "start" followed by your >application-launching command. For instance make a file named >"run.bat" which contains a line like, "start javaw MyClass". > >2. Create a shortcut to that batch file. In the properties of the >shortcut set it to Run: Minimized. > >3. Launch the application by double clicking on the shortcut. > >Note that you cannot make this work by double clicking on the batch >filename, or on a jar or class filename. Unless you have discovered >more than I, which I would be glad to learn. > >This works equally well with a main class file or with an executable jar file. > >If you are curious, I experimented with permutations in the >application-launching command and tell what I found below. The >variations tested are: > "start" or not; > start with "/B" or not; > "java" or "javaw"; > class or jar. > >In all cases the shortcut is set to run minimized. The app was >launched by double clicking on the shortcut to the batch file. > > >APPLICATION- > LAUNCHING > COMMAND - results > >java MyClass - the command prompt taskbar button (TBB) stays while >the app runs. Closing TBB closes the app. > >javaw MyClass - TBB stays while the app runs, >but closing TBB does not close the app. > >start java MyClass - The command window opens on the screen (in spite >of being minimized in the shortcut). Closing it closes the app. > >start javaw MyClass - TBB flashes briefly. Otherwise behaves as >desired. > >start /B javaw MyClass - same as above. > >start /B java MyClass - TBB stays while app runs. Closing it closes the >app., like "java MyClass" above. > > >Rich Hammer >Hillsborough > > >Joe Sam Shirah wrote: >> For whatever reason, the minds at Sun have not resolved it. About the >>best you can do with javaw is to have a batch ( .bat ) file with this line >>in it: >>start /b javaw ClassYouWantToRun >>*THEN* >>in the shortcut properties, select >>Run Minimized >> You will still see a brief *minimized* DOS window on the taskbar ( >>>> >>>>----- Original Message ----- From: "Richard O. Hammer" >>>><[email protected]> >>>>To: "Java Users Group" <[email protected]> >>>>Sent: Thursday, September 08, 2005 9:11 PM >>>>Subject: [Juglist] launching application in Windows without DOS >>>>commandwindow >>>> >>>>>Is there an easy way to launch a Java Swing application in Windows 2000 >>>>>without opening a DOS command window? >>>>> >>>>>I know that I can make a .bat file containing "java ClassName" and then >>>>>double click on the file name, or create a shortcut to the .bat file, >>>>>but that always seems to open the command window which stays open as >>>>>long as the application is running. >>>>> >>>>>My Googling has found Java Web Start, a lot about Java Web Start. I've >>>>>started looking at that and it looks like probably it would be easier >>to >> >>>>>learn to use Java Web Start for my "hello world" application than it >>>>>would be to get a Masters degree. >>>>> >>>>>But I still imagine that it can be easy. I am not concerned about >>>>>security. I am not loading anything over the net. I just want to >>start >> >>>>>my local application with no more hassle than starting Notepad. >>>>> >>>>>Can I create a Windows shortcut that says something like >>>>>java -classpath path1;path2 MyClass >>>>>to the Windows OS, without opening a command window? > >_______________________________________________ >Juglist mailing list >[email protected] >http://trijug.org/mailman/listinfo/juglist_trijug.org