aspose 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
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: 759
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: 42611
    
  65
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?


Ping & DNS - my free Android networking tools app
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
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: 19760
    
  20

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
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