• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to call windows exe file placed in windows machine from unix machine

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I want to call exe file which is place in windows environment from Unix operatign system, unix and windows server are place in same organization (different countries).

Can any one tell how can I call exe file.

 
Ranch Hand
Posts: 129
Netbeans IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Method 1:
Use java RMI to execute a remote method on the target machine, which in turn executes a program in that machine using Runtime class.

Method 2:
You can use java sockets to transmit a message to the target machine and the program on the target machine on receiving this message executes a program using Runtime class.

 
vardhan reddy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Nitin,

Can you please explain in details, I have no idea how to communicate between unix and windows.
If possible please provide any documents, it will be very helpful.

If I call below code what will happen, does it execute windows exe file?
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't call Windows programs directly from a Unix machine. Unix uses a completely different mechanism for executables. You will need to setup a client-server pair, with the client on the Unix machine and the server on the Windows machine. The client sends commands to the server which will then use Runtime.exec or ProcessBuilder to execute these commands. That's what Nitin meant.
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. You can youse Ant's 'telnet' task to log on to the remote unix and execute the commland there.
. Some FTP servers support the 'site exec' command. If your company's unix machine runs such an ftp server, that would be an option.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be warned that Telnet is a very insecure protocol. You should not allow any computer outside your local network to use it, and even within the local network you should limit access as much as possible.
 
Jan Cumps
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:Be warned that Telnet is a very insecure protocol. You should not allow any computer outside your local network to use it, and even within the local network you should limit access as much as possible.


Yes it is (same for FTP). These protocols send everything readable over the network. It is always a good idea to let the company's security team validate the approach.
The good thing is that the vulnerabilities are known . Starting to build an own client/server application/protocol from scratch might introduce security holes still unknown to mankind.

Next step could be to step over to SSH , SSH tunneling
Maybe the WAN route between the two countries is already secured and encrypted?

 
vardhan reddy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rob/Jan,

We are calling with in our network only and I got one option to call windows services using FreeTDS.
and we are checking to mount windows folder and use it in unix machine(not calling exe/ control files).
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just because you can mount the Windows shares and see the .exe files doesn't mean you can run them.
 
vardhan reddy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, got your point.
We are planning to mount folders which contains excel files (these files will be used by exe). we will place exe file in unix environment itself.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That won't work, unless you can use Wine to open the exe files. That probably means that you need to install the application properly in Wine.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vardhan reddy wrote:We are planning to mount folders which contains excel files (these files will be used by exe). we will place exe file in unix environment itself.


As has already been pointed out, Unix CANNOT execute .exe files, so it doesn't matter where you "put" it. On the other hand, OpenOffice CAN open most Excel files (and edit them; although what it replaces them with may not be the latest type).

Winston

BTW: I would suggest using Samba to connect your Windows shares. It is very robust and I believe can be tunnelled through SSH (although I've never tried it).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic