2018年4月26日木曜日

PHPからJavaを呼び出す

Webシステム側はPHPで書いてありますが、そこからJavaを呼び出して処理をさせます。
(1) Javaの設置
jarファイルで設置も考えましたが、変更もあり得るのでそのまま設置しました。
今回は以下を設置しました。
https://github.com/smzn/Sentiment
今回は外部jarファイルがあるので、/usr/local/lib にjarファイルを入れておき
$ vi ~/.bashrc
export CLASSPATH=/usr/local/lib/mysql-connector-java-5.1.45-bin.jar:/usr/local/lib/io.indico-3.15.0.jar:/usr/local/lib/io.indico-3.15.0-jar-with-dependencies.jar:$CLASSPATH
と設定しました。
全ユーザに対して設定する場合は /etc/profileに書きます。
実行できることを確認します。

(2)シェルスクリプトの作成
シェルスクリプトを作成し、置いておきます。クラスパスは必要です。
$ vi ~/indico/sentiment.sh


$ chmod +x ~/indico/sentiment.sh
シェルスクリプトから実行できることを確認します。
$ ~/indico/sentiment.sh

(3) PHPから呼び出し
PHPから呼び出すときに、exec関数を利用します。


これでPHPからJavaを実行できました。

17 件のコメント:

  1. Thanks for sharing, nice post! Post really provice useful information!

    Giaonhan247 chuyên dịch vụ mua hộ hàng hàn quốc uy tín và là công ty vận chuyển hàng trung quốc uy tín với dịch vụ gửi quần áo đi mỹ giá rẻ với kinh nghiệm mua hàng amazon nhật với giải đáp mua nước hoa chính hãng ở đâu tốt cũng như cách order hàng nhật về việt nam uy tín.

    返信削除
  2. I like it my bro I love your support team . Real Racing 3 mod apk

    返信削除
  3. このコメントは投稿者によって削除されました。

    返信削除
  4. great information provide on this article i am clear about every steps and how to download without issue one https://greatmodapk.com/showbox-apk/

    返信削除
  5. Thanks for sharing.
    https://gta5-mobile.com
    https://teresafidalgo.info
    https://ppssppapk.info
    https://spotifypremiumfreeapk.info

    返信削除
  6. Kaomoji represents Japanese words and the face of the Japanese people through a letter Download. It is not at all like the western kaomoji which you are seeing Click Here next to it :) which looks like this now you must have understood and Japanese Kaomoji is a very big category which is in a lot of categories and which Lenny The face is, it is definitely used to use the bracket to show the face of the person additionally. So now you have understood the difference between kaomoji vs Lenny's facekaomoji

    返信削除
  7. wow good to use KineMaster Diamond APK, if want to use then download from here.

    返信削除
  8. UFO VPN MOD APK is a one-of-a-kind VPN that specializes in the thing that other VPNs do not offer. This is the Fast speed internet. With the MOD version there are better features.

    Download it from here.. https://apksdesk.com/ufo-vpn-mod-apk/

    返信削除
  9. Animation Throwdown Mod Apk is a great choice for everyone, A full of fun games. The goal of this game is to collect cards and battle against your favorite character.

    click here.. https://apkshut.com/animation-throwdown-mod-apk/

    返信削除
  10. This is an application that allows you to make sure that you get the best of the best in a video editing application. You will be making sure that you have the best time with the features of the Vivavideo Mod Apk version.

    check it now.. https://apksspot.com/vivavideo-mod-apk/

    返信削除
  11. You will be making Real Cricket 20 Mod Apk sure that you get the chance to have the best of the best in this game with the unique and extraordinary experiences that you will have and you will be able to make sure that you have an extraordinary time in the game.

    Visit my all apps website.. https://apksspace.com/real-cricket-20-mod-apk/

    返信削除
  12. このコメントは投稿者によって削除されました。

    返信削除
    返信
    1. Likee Mod Apk allows you to watch, upload, and download videos. Unlike other video sharing applications, Likee modified version does not require users to log in or register. Likee Premium is a fantastic app that allows you to stay in touch with friends and family no matter where they are. Chat, share images and videos, and make free international calls are all available via the app. Continue reading to learn more about this fantastic app. For the most part, the Likee app has you covered. If you want to let your followers know about a new video from your favorite band or share some more beautiful images from your recent trip, Likee can make it easy.

      Check it for more details.. https://apksdot.com/likee-mod-apk/

      削除
  13. If you are talented and want to show it to the world then Bigo Live Mod Apk is for you. Also this app is the best choice to show the world your talent and prove yourself.

    click here.. https://subapks.com/bigo-live-mod-apk/

    返信削除