用Wrapper將java程式註冊為服務

2021-09-01 16:21:47 字數 393 閱讀 6403

c、新建乙個以專案為名稱的檔案,裡面的指令碼大多來自模版,只需簡單修改幾個引數即可。是否以專案作為名稱,完全取決於你,linux的風格是以專案名+d的方式命名服務。

2、新建啟動指令碼(參見附件中/bin/testmonitord檔案)

monitordaeon_home=/opt/testmonitor

只需修改上面這幾個引數即可。

3、將上面新建的指令碼拷貝至/etc/init.d目錄,並且將許可權設定為755

# cp ./bin/testmonitord /etc/init.d/

# chmod 755 /etc/init.d/

testmonitord;

測試 # service 

testmonitord

start

將java程式轉換為 exe程式

注意 如果連資料庫,最好不要採用配置檔案的方式 打包為jar檔案之後找不到配置檔案的路徑 properties prop new properties reader in try catch exception e driver prop.getproperty driver url prop.ge...

《Java程式》將數字進行倒序輸出

描述 任意給定乙個數字,寫乙個函式,能夠將數字進行倒序輸出。write a program to reverse a number using numeric operators.不管是什麼樣的程式語言,剛開始接觸到程式設計的時候都會有這樣的題目。package test write a progr...

用java程式直接訪問URL位址

程式中訪問http資料介面 public static string geturlcontent string urlstr catch exception ex finally catch ioexception ex string result sb.tostring system.out.pr...