在 RaspberryPi 上自动启动 JavaFX 应用程序 [英] Autostart JavaFX Application on RaspberryPi

查看:27
本文介绍了在 RaspberryPi 上自动启动 JavaFX 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 JavaFX 应用程序,该应用程序在Raspberry Pi"(基于 ARM 的小型 Linux 计算机)上运行.Pi"上的操作系统是Raspbian"(用于 Raspberry Pi 的 Debian Linux).我在 Raspbian 上安装了 JDK8 以在没有 X-Server 的情况下运行图形 JavaFX 应用程序.这一切正常:) 我可以通过输入以下命令来启动应用程序:

I programmed a JavaFX application which runs on a "Raspberry Pi" (a small ARM based Linux Computer). The OS on the "Pi" is "Raspbian" (a Debian Linux for Raspberry Pi). I installed JDK8 on Raspbian to run graphic JavaFX Application without X-Server. This all works fine :) I can start the Application by entering the following command:

/opt/jdk1.8.0/bin/java -cp /home/pi/sqljdbc4.jar:/home/pi/Leitwarte.jar leitwarte.Leitwarte

当应用程序启动时,它会完全控制鼠标和键盘,因此无法返回控制台,但这并不重要,因为它只是一个监控系统,我可以通过 ssh 关闭 mashine.

When the application starts it takes full control over mouse an keyboard, so there is no way back into console, but this doesent maters because it is just a monitoring system an i am able to shut the mashine down over ssh.

我现在想在启动后直接启动应用程序,这样就不需要输入用户名、密码和启动应用程序了.

I now want to start the application directly after booting, so that there is no need for entering username ,passwort and starting the application.

mashine 只运行应用程序(当然有一个 ftp、ssh 守护进程来更新应用程序)

The mashine does nothing else just running the app (of course there runs a ftp, ssh deamon for making updating the app posible)

请一步一步告诉我,因为我很长时间不使用 Linux.

Please tell me step by step, because i dont work with Linux for a long time.

非常感谢.

推荐答案

CMD

cd /etc/init.d
sudo nano leitwarte

输入以下内容

#! /bin/sh
# /etc/init.d/leitwarte

touch /var/lock/leitwarte

case "$1" in
start)
echo "Starting Leitwarte ... "
/opt/jdk1.8.0/bin/java -cp /home/pi/sqljdbc4.jar:/home/pi/Leitwarte.jar leitwarte.Leitwarte > /dev/null &
;;
stop)
echo "Killing Leitwarte ..."
killall java
;;
*)
echo "Usage: /etc/init.d/leitwarte {start|stop}"
exit 1
;;
esac
exit 0

然后

chmod 755 leitwarte
update-rc.d leitwarte defaults

完成

这篇关于在 RaspberryPi 上自动启动 JavaFX 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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