導航:首頁 > 配伺服器 > 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地址相關的資料

熱點內容
linux命令強制退出 瀏覽:77
videostation怎麼添加文件夾 瀏覽:184
pythonrawsocket 瀏覽:861
編譯原理計算思維能力 瀏覽:247
衛星加密技術的應用 瀏覽:901
怎麼看手機實用頻率高的app 瀏覽:72
c實現sha1演算法 瀏覽:784
h200cy1是多大壓縮機 瀏覽:62
hbase查看錶結構命令 瀏覽:861
怎麼將rar解壓成安裝包 瀏覽:29
程序員幾點開始學習 瀏覽:201
linux百度雲文件 瀏覽:398
下載軟體解壓到哪裡合適 瀏覽:264
百度智能雲演算法工程師 瀏覽:98
模鍛造pdf 瀏覽:211
dom編程api 瀏覽:58
批處理復制命令 瀏覽:503
廢鐵壓縮打包機 瀏覽:98
linux打開圖形界面命令 瀏覽:368
女孩子學習程序員還是剪輯師好 瀏覽:284