从Java内存中执行可执行程序(.exe) [英] Execute an executable program (.exe) from memory in Java

查看:146
本文介绍了从Java内存中执行可执行程序(.exe)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows的内存中执行程序.我不想将文件写入磁盘.我只想传入一个字节数组(这是我要执行的程序)作为参数.

I want to execute a program in memory on Windows. I do not want to write the file to disk. I just want to pass in a byte array (which is the program I want to execute) as a parameter.

我没有足够的技能来编写本机代码来做到这一点.同样,这应该是Windows本机.

I am not skilled enough to write the native code to do this. Again, this should be Windows native.

我要在内存中执行的程序不是Java程序.它是一个可执行文件(.exe)!该可执行文件应以内存形式读取和运行,而不是通过 Runtime.getRuntime().exec("example.exe");

The program I want to execute in memory is not a Java program. It is an executable (.exe)! The executable is meant to be read and run IN MEMORY, not through Runtime.getRuntime().exec("example.exe");

推荐答案

我无法发表评论,否则我会发表评论.您应该能够在这里找到一些有用的信息,人们正在尝试使用C ++解决相同的问题.请告诉我,您是否要编写跨平台或仅Windows的程序?您对".exe"的使用仅表示Windows.

I can't comment yet, otherwise I would. You should be able to find some useful information here, where people are trying to solve the same problem using C++. Pray tell, are you trying to write a program that is cross platform, or Windows only? Your use of the ".exe" indicates windows only.

从内存缓冲区创建进程

理论上,只要您不尝试建立此跨平台平台,您就应该能够使用Windows API调用来实现此目的.

You should theoretically be able to make this work by using Windows API calls, as long as you aren't trying to make this cross platform.

这篇关于从Java内存中执行可执行程序(.exe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆