イントロダクション
RPi(ラズパイ)にJavaFXで作成した画面をデプロイして起動するテストを行います。
ちなみに、JavaFXは下のようなGUIアプリケーションを作成することができます。
画面上のPNG画像を動かして、画面の下部分に文字を表示したりしています。
〜RPiのセットアップ〜
・ラズパイのインストールなど(コンソールのみ)
・ラズパイのセットアップで使用したコマンドなど
Introcuction
I will deproy to RPi and execute JavaFX on RPi to testing deployment java apps.
〜Abount setting up RPi〜
・Installing RPi in CUI
・settingup wifi on RPi
・Memos abount commands for setting up RPi
詰まったところ
1.「RPi(ラズパイ)にLAN検索のための設定(インストールなど)をしていなかった。」
1.My RPi has not "nslookup" and "dig". That's why I can not find my Mac.
「nslookup」「dig」コマンドのインストール
$sudo apt-get install dnsutils
でインストール終了。
2.RPiがMac (使用している端末)から見つからなかった。
2.My Mac can not find RPi.
以下の様にコマンドを叩き探しました。
>arp -an
下の様に出力される
ポイントは下の様なIPアドレスを参考にする
>ifconfig
RPi(ラズパイ)で上のコマンドを叩く、そしてIPアドレスから対象のものを見つける
use "ifconfig" and find IP Mac and RPi.
>hostname
RPiで上のコマンドを叩きラズパイの端末名(ホスト名)を取得する
check RPi host name. my RPi host name is "raspberrypi".
今回は「raspberrypi」がそれでした。
※hostnameは変更が可能です。
>ssh pi@rasbberrypi
>sudo raspi-config
このコマンドでSSHが動いているかどうか確認、設定する
check ssh in "ssh pi@raspberrypi" command.
and "sudo raspi-config" to setting about SSH server.
Mac(Windows)でRPiにアクセスする
>ssh <RPiのユーザー>@<IPアドレス or ホスト名>
実行したコマンド
>ssh pi@192.168.XXX.XXX
この後に「続けますか?」と質問があるので「yes」と入力
<例>
しかし、ログインしているユーザーのみだったのでログインできませんでした。
But RPi is using "pi", so I can not login RPi. cause I have already logged in RPi.
<LANケーブルの設定>
</etc/network/interfaces> #eth0を固定値でIPアドレスを設定する → これは接続できませんでした。 #Can not access RPi when I tried as bellow iface eth0 inet static address 192.168.XXX.XXX # 自分は192.168.88.88と設定しました。 netmask 255.255.255.0 gateway 192.168.XXX.254 # "XXX"は「address」と同じものにします。 #eth0をDHCPで設定する Using "eth0" for DHCP iface eth0 inet dhcp →これは繋がった I can connect RPi
sudo ifup eth0で"eth0"を起動します。※eth0を定義していない場合
if you did not set "eth0" then you write like this.
3.ユーザーがすでにログインしているユーザーのみだった
3."pi" user have been already logged in RPi.
ユーザーを新たに作成する。
create user on RPi.
ユーザー追加
sudo adduser "ユーザー名"
ユーザーパスワード(sudo権限あり)
sudo gpasswd -a "ユーザー名"
改めて接続する Try again connect RPi
>ssh pi@192.168.XXX.XXX
以下の様な文言が出ました。赤字は隠した部分です。
The authenticity of host '192.168.XX.XX (192.168.XX.XX)' can't be established. ECDSA key fingerprint is SHA256:KXxaXjFgIEb7I6KP5+kkGJUcYizlE8uaLUgV/z7wlK4. Are you sure you want to continue connecting (yes/no)? y Please type 'yes' or 'no': yes <<「yes」と入力 >> Warning: Permanently added '192.168.XX.XX' (ECDSA) to the list of known hosts. takunoji@192.168.XX.XX's password: <<パスワードを入力(input password)>> Linux raspberrypi 4.14.66+ #1137 Fri Aug 24 16:31:57 BST 2018 armv6l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
こんな感じで接続完了 you can see it as bellow
そして、いよいよデプロイ Let's Deploy!
作成したJarファイルのディレクトリに移動します。
cd ~/ProjectX/out/artifact/XXX.jar
そして、下のコマンドを叩きます
### scp XXX.jar ユーザー名@192.168.XX.XX:/home/ユーザー名 ### scp RpiCtl.jar takunoji@192.168.XX.XX:~/
ファイルのアップロードが完了しました。just you finished deploy your jar file.
OK! Let's execute jar file now!!
java -jar RpiCtl.jar
But I can not see javaFx view. cause as bellow だが、起動できず。。。
ARM用のJavaFXが必要なんですと。。。