exe4j 图文教程
https://www.cnblogs.com/duwanjiang/p/6390379.html
https://blog.csdn.net/dantelzp/article/details/72819094
https://blog.csdn.net/huningjun/article/details/42102499
https://www.cnblogs.com/lenic/p/4097045.html
https://www.cnblogs.com/duwanjiang/p/6390379.html
java 程序转换为服务
https://jingyan.baidu.com/article/fc07f9895ca02412ffe5198d.html
一个winform小程序 在后台打开一个console程序,并且接受其控制台输出,在form的rich控件上显示数据
public Form1() { InitializeComponent(); p = new Process(); p.StartInfo.FileName = "XXXX.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; p.OutputDataReceived += (s, e) => { this.BeginInvoke(new Action(() => { rich.Text += e.Data; })); }; p.Start(); p.BeginOutputReadLine(); }
Jar如何转换为windows服务文件
Maven工程的pom如下配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.legion.prime_server</groupId> <artifactId>PrimeServer</artifactId> <version>0.0.1-SNAPSHOT</version> <dependencies> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>4.1.25.Final</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20180130</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.3</version> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>com.javanorm.MainServer</mainClass> </manifest> </archive> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>assembly</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
安装Maven,设置好环境变量中的path,
使用Maven进入到工程目录下,使用命令mvn package
即可生成jar包,该jar包可生成合法window service文件。使用advanced installer安装即可。