Using Java code to fetch C # applications and implement data interaction

Source: Internet
Author: User

using Java code to fetch C # applications and implement data interaction

This article mainly introduces applications that call C # through Java and passes parameters to C # clients. Before doing the project encountered this function, by the way to share the code out;

Requirements:

1.java is the web framework, deployed in the server

2.c# client (is EXE file) placed in the server, C # program is responsible for the transfer of another service data

3.javaweb projects and C # clients are in the same server

3. Require Java code to start a C # program and pass a parameter to C #; C # is the console program Main method

4. It is more noteworthy that the C # client code has access to the network drive disk path, the network drive disk (meaning that the disk of another server is mapped to the local server to access the path), so there is a big problem,

It is no problem to manually start the C # client directly in the server, you can access the network drive disk path; The problem is, the Javaweb front button executes Java code to fetch the C # client, when the C # client cannot find the network Map drive path, and therefore needs to modify the C # code. Implement network drive disk sharing. There is no introduction to a Web-driven application that cannot access the network drive, and put it on another blog.

implementation:

Java code:

/**

*command is an EXE path, such as (D:\\c#.exe)

*param is the parameter passed to the EXE

* Note Do not use process to fetch the program, because cannot pass the parameter

**/

Private Boolean Execbat (String command,string param) {
try {

Processbuilder p= New Processbuilder (Command,param);/only use Processbuilder, no process
P.start ();
catch (IOException e) {
return false;
}
return true;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.