Python Open A Jar Shortcut
I have a JAR file saved on my desktop, is there a way that I ca get python to pen this up, as if I was just clicking on the link from my desk top, I am very new to python and know
Solution 1:
Why do you want to execute it via Python?
In my Windows environment such .jar
file is executed by Java:
C:\jre7\bin\javaw.exe -jar "%1" %*
Of course your OS should be able to change such association to open .jar
with other program. On my Windows I can use local menu to open .jar
file with Java, Eclipse, Firefox or I can chose other program.
Solution 2:
I'll assume you're using Windows (it seems that way from how you've presented the question).
To simulate double-clicking a file on Windows, use os.startfile
(available only on Windows):
os.startfile("path/to/myjarfile.jar")
This will do whatever your system is configured to do with files with a .jar
extension.
For a more complete answer on starting files on Windows see this answer.
Post a Comment for "Python Open A Jar Shortcut"