Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes IDEs, Version Control and other tools and the fly likes Converting .jar to .bat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Converting .jar to .bat" Watch "Converting .jar to .bat" New topic

Converting .jar to .bat

pappitha swaminathan

Joined: Aug 16, 2011
Posts: 9

I am having my own executable jar named "SFTP.jar" which includes jsch.jar, mail.jar and activation.jar. I want to convert the whole content to .bat file as SFTP.bat.

Could you please help me in this. Since am unaware of conversion.

P.S : My jar is working fine. i want it as .bat file.

Thanks in advance.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

But... a jar file is a container for Java classes and perhaps other resources. It's structured like a zip file internally. Whereas a .bat file is a text file containing a script of commands which are meant to be executed sequentially.

So I have no idea what you mean by converting a jar file to a bat file. It's like asking to convert a train timetable to a bicycle. But perhaps you could explain what you want, and perhaps give an example.
pappitha swaminathan

Joined: Aug 16, 2011
Posts: 9
Hi Paul,

Thans for your reply. Wat i mean is, jar files can be executed through command line rite, those content should be in a text file which is saved as ".bat" and execute.

Am having a problem that my jar will work if it contains third paty api as "mail.jar", "jsch.jar". i want to set class path for those in text file and execute.

i dint mean to convert train to bicycle, want to ride train like bicycle.

Peter Johnson

Joined: May 14, 2008
Posts: 5852

Here is a simple bat file that does what you want:

JBoss In Action
I agree. Here's the link:
subject: Converting .jar to .bat
It's not a secret anymore!