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

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

问题描述

我编写了一个运行在Raspberry Pi(基于ARM的小型Linux计算机)上的JavaFX应用程序。 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 deamon用于更新app posible)

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天全站免登陆