This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hai, How can we execute a java class file in windows by right clicking & using 'sendTo' to a batch file & execute it like an exe file.Also help me how to send command line arguments too from windows environment to run it as I said.We can also run the file by just double clicking by setting the openwith property to the batch file we write.
Write a bat file to invoke the class file. You can double click the bat file.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Aug 09, 2001
Hai Cindy, I think u have misunderstood my question.I want to run any java class file by double clicking, as we open an ordinary text file in notepad by double clicking it.can u please send me the source code of the batch file,better post it in u'r reply rather than mailing me,so that it helps a lot more than me. Thank You.
Joined: Sep 29, 2000
I don't think that you can set up windows to be able to double click a class file like an exe. You CAN do that with jar files (most window systems come with that pre-defined in the MIME types) I use WinNT and if I go into Explorer/view/Folder Options/apps and look for Executable Jar File it is defined to start with this command: C:\Program Files\JavaSoft\JRE\1.4\bin\javaw.exe -jar with a content_type(MIME) of execution\java. However if I want to start an application and make an Icon I create a myApp.bat file then in it we set the classpath ind invoke the application with any parameters needed. http://www.javaranch.com/ubb/Forum34/HTML/000965.html
[This message has been edited by Cindy Glass (edited August 21, 2001).]