如何在Ubuntu Linux启动时运行Java应用程序 [英] How to run Java application on startup of Ubuntu Linux

查看:237
本文介绍了如何在Ubuntu Linux启动时运行Java应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要开发读取TCP/IP套接字的应用程序的要求.我成功地将程序制成Java程序,而没有GUI意味着程序运行后,它将开始侦听Socket并在Netbeans IDE的帮助下获得响应.现在,按照我的要求,我必须在Linux系统启动后立即开始执行该程序.

I have a requirement where I need to develop application that reads TCP/IP Socket. I successfully made the program as Java program with No GUI means as soon as program runs it starts listening to the Socket and gets the response with the help of Netbeans IDE. Now as per my requirement i have to start execution of this program as soon as Linux system Booted.

实际上我是Java和Linux平台的新手,所以毫无疑问.

Actually I am very novice in Java and Linux Platform, so have few doubts..

  1. 我的没有GUI的套接字程序是否可以按我的要求运行?
  2. 我知道如何在Linux Boot up上运行脚本来运行jar. init.d用于此目的.
  1. Is my Socket Program with no GUI is fine to be run as per my requirement.
  2. How can I write script to run jar on Linux Boot up, I got to know. init.d is meant for this.

推荐答案

理想地,您应该为Java应用程序创建服务包装,然后使该服务在启动示例

Ideally you should create a service wrapper for your java application and then make this service run on startup example here.

使用
sudo update-rc.d mytestserv defaults在Ubuntu上启动时运行服务包装器

Use
sudo update-rc.d mytestserv defaults to run your service wrapper on startup on Ubuntu

这篇关于如何在Ubuntu Linux启动时运行Java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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