• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

run java class files by double clicking(urgent)  RSS feed

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a bat file to invoke the class file. You can double click the bat file.
 
netharam ram
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO you could do some workaround and create a shortcut that does something like:
c:\jdk1.3\bin\java.exe -classpath <some classpath> SomeClass
as the command line (In Properties)
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it can be done as you described. Dirty, thrown together code:
RunClass.java:

Register.reg:
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've updated my java code since the last post, but I noticed something odd. There is a commented out section in the middle. For some reason it isn't needed. I don't know why. Do you?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!