導航:首頁 > 配伺服器 > java獲取nuix伺服器ip地址

java獲取nuix伺服器ip地址

發布時間:2024-08-27 07:17:59

❶ 如何查看unix伺服器java進程數量

可以使用ps命令。它能顯示當前運行中進程的相關信息,包括進程的PID。linux和UNIX都支持ps命令,顯示所有運行中進程的相關信息。
ps命令能提供一份當前進程的快照。如果你想狀態可以自動刷新,可以使用top命令。

❷ java程序中調用帶通配符*的unix系統命令

由於在linux環境下,我們一般使用bash shell調用這些命令, 而其中的一些符號 諸如:
*, ?, >, < , | 這樣的符號是通過/bin/bash -c來做解釋後再傳遞給 所調用的命令
/bin/bash -c 這個參數已經作為默認命令,在系統啟動時載入到運行環境中,所以我們敲以上命令的時候可以省略
但對於java的Process來說,不會識別這些符號,因此我們必須強制調用/bin/bash -c來幫我們做符號解釋:
http://tuhaitao.iteye.com/blog/1047820

❸ java獲得當前伺服器的操作系統是什麼怎麼獲得

import java.util.Properties;

public class Test{

public static void main (String args[]){
Properties props=System.getProperties(); //系統屬性

System.out.println("Java的運行環境版本:"+props.getProperty("java.version"));
System.out.println("Java的運行環境供應商:"+props.getProperty("java.vendor"));
System.out.println("Java供應商的URL:"+props.getProperty("java.vendor.url"));
System.out.println("Java的安裝路徑:"+props.getProperty("java.home"));
System.out.println("Java的虛擬機規范版本:"+props.getProperty("java.vm.specification.version"));
System.out.println("Java的虛擬機規范供應商:"+props.getProperty("java.vm.specification.vendor"));
System.out.println("Java的虛擬機規范名稱:"+props.getProperty("java.vm.specification.name"));
System.out.println("Java的虛擬機實現版本:"+props.getProperty("java.vm.version"));
System.out.println("Java的虛擬機實現供應商:"+props.getProperty("java.vm.vendor"));
System.out.println("Java的虛擬機實現名稱:"+props.getProperty("java.vm.name"));
System.out.println("Java運行時環境規范版本:"+props.getProperty("java.specification.version"));
System.out.println("Java運行時環境規范供應商:"+props.getProperty("java.specification.vender"));
System.out.println("Java運行時環境規范名稱:"+props.getProperty("java.specification.name"));
System.out.println("Java的類格式版本號:"+props.getProperty("java.class.version"));
System.out.println("Java的類路徑:"+props.getProperty("java.class.path"));
System.out.println("載入庫時搜索的路徑列表:"+props.getProperty("java.library.path"));
System.out.println("默認的臨時文件路徑:"+props.getProperty("java.io.tmpdir"));
System.out.println("一個或多個擴展目錄的路徑:"+props.getProperty("java.ext.dirs"));
System.out.println("操作系統的名稱:"+props.getProperty("os.name"));
System.out.println("操作系統的構架:"+props.getProperty("os.arch"));
System.out.println("操作系統的版本:"+props.getProperty("os.version"));
System.out.println("文件分隔符:"+props.getProperty("file.separator")); //在 unix 系統中是」/」
System.out.println("路徑分隔符:"+props.getProperty("path.separator")); //在 unix 系統中是」:」
System.out.println("行分隔符:"+props.getProperty("line.separator")); //在 unix 系統中是」/n」
System.out.println("用戶的賬戶名稱:"+props.getProperty("user.name"));
System.out.println("用戶的主目錄:"+props.getProperty("user.home"));
System.out.println("用戶的當前工作目錄:"+props.getProperty("user.dir"));

}

}

❹ java如何查詢本機ip地址和mac地址

Java中可以使用程序來獲取本地ip地址和mac地址,使用InetAddress這個工具類,示例如下:

importjava.net.*;
publicclassNetInfo{
publicstaticvoidmain(String[]args){
newNetInfo().say();
}
publicvoidsay(){
try{
InetAddressi=InetAddress.getLocalHost();
System.out.println(i);//計算機名稱和IP
System.out.println(i.getHostName());//名稱
System.out.println(i.getHostAddress());//只獲得IP
}
catch(Exceptione){e.printStackTrace();}
}
}

也可以通過命令行窗口來查看本地ip和mac地址,輸入命令:ipconfig。

❺ 怎麼在java中執行UNIX腳本代碼

public static void parseLog(ArrayList<String logAddress,
ArrayList<String exceWords, HashMap<String,String excelevel,String beginTime,int start,int end,String fmt) throws IOException,
InterruptedException {
Date date = null;
long dbDate = 0;
dbDate = DBLogExce.getMaxDate();
for (int i = 0; i < logAddress.size(); i++) {//遍歷URLString url = logAddress.get(i);
//主要運用java中的Process類,調用exc();方法,執行命令,的到輸入流,解讀文件,
Process proc = null;try {proc = Runtime.getRuntime().exec(
"grep " + "'" + beginTime + "' " + url);
} catch (IOException e) {
e.printStackTrace();}InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null)
System.out.println("<OUT");
for(int j=0;j<exceWords.size();j++){
//判斷當天的日誌是否包含異常關鍵字
int index = line.indexOf(exceWords.get(j));
if(index!=-1){
String exceLevel = excelevel.get(exceWords.get(j));
//解析異常得到時間
line = line.substring(start, end);
date = ToolUtils.parseToDate(line, fmt);
long l = date.getTime();
//判斷大於資料庫最大時間,插庫

閱讀全文

與java獲取nuix伺服器ip地址相關的資料

熱點內容
緩解壓力最好的辦法美國 瀏覽:387
前後端系統數據加密解密 瀏覽:194
中國移動營業app怎麼看套餐 瀏覽:205
javastatic數組 瀏覽:950
需要會員管理源碼 瀏覽:415
手機app如何解除加密 瀏覽:167
用雲伺服器還得買個瘦主機 瀏覽:728
如何查看辦公電腦伺服器地址 瀏覽:368
海星雲的伺服器是什麼系統 瀏覽:411
抖音小籠包解壓神器 瀏覽:558
手機下載的源碼在哪裡儲存 瀏覽:846
pdf看三維 瀏覽:406
九宮演算法干什麼用的 瀏覽:907
phpjava性能比較 瀏覽:886
2016會計中級pdf 瀏覽:181
農村信用社app怎麼刪除明細 瀏覽:817
學而思電腦怎麼下載app 瀏覽:107
php防止mysql注入 瀏覽:233
磁力計校正演算法 瀏覽:491
解壓縮後變小了 瀏覽:958