File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes exe of a jar file + passing parameter from cmd prompt to exe Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "exe of a jar file + passing parameter from cmd prompt to exe" Watch "exe of a jar file + passing parameter from cmd prompt to exe" New topic
Author

exe of a jar file + passing parameter from cmd prompt to exe

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 744
Hi,

can we create an EXE of a jar file. the extension should be exe for Eg : testJar.exe

and can we pass parameter to the exe from comand prompt

for Eg :

C:\tesJar.exe 9969413222 Jigar

the functionality of the testJar.exe is to get the parameter and log it into the file system.

can it be possible ?

Thanks & Regards.
Jigar Naik


Jigar Naik


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35252
    
    7
You can create a batch file (a.k.a. shell script) that runs the jar file and passes in whatever parameters it received.

Or is the objective to create native code?


Android appsImageJ pluginsJava web charts
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 744
well we have another application which was written in C++ which has opetion in GUI for executing .exe files.

so batch wont work. plus we have to pass arguement to exe. at run time.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

You can call java.exe or javaw.exe:

If it is a windowed application use javaw.exe, otherwise use java.exe

If you need the full path to java.exe, you can use %WINDIR%\system32 as the path, which usually translates to C:\WINDOWS\system32


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 744
Hey Rob,

Thanks a lot, I think that should work fine.

Regards,
Jigar Naik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exe of a jar file + passing parameter from cmd prompt to exe
 
Similar Threads
Problem after making an application using JDBC
Security of Java Jar file
how to convert java file in to exe. file ..........
How to create exe file
Running a .exe file from a .java file