JAVA得到网卡物理地址(windows和Linux)
在我们在写程序的过程中,有些时候需要知道一些电脑的硬件信息,比如我们写一些需要注册的程序的时候,就需要得到某个电脑特定的信息,一般来说,网卡的物理地址是不会重复的,我们正好可以用它来做为我们识别一台电脑的标志.那如何得到网卡的物理地址呢?我们可以借助于ProcessBuilder这个类,这个类是JDK1.5新加的,以前也可以用Runtime.exce这个类.在此我们将演示一下如何在Windows和Linux环境下得到网卡的物理地址.
代码如下:
/*
* Test.java
*
* Created on 2007-9-27, 9:11:15
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author hadeslee
*/
public class Test {
public static String getMACAddress() {
String address = "";
String os = System.getProperty("os.name");
System.out.println(os);
if (os != null) {
if (os.startsWith("Windows")) {
try {
ProcessBuilder pb = new ProcessBuilder("ipconfig", "/all");
&nbs
相关文档:
window下的sqlplus可以通过箭头键,来回看历史命令,用起来非常的方便。
但是在linux里就没有这么方面了,错了一个命令,我们必须重新敲一次,辛苦了手指头叻。
看到一个文章,很方便的一招,给我们带来方便。
通过rlwrap包实现linux里的sqlplus历史命令的功能
可以下载rlwrap包从inthirties里。
这个包依赖readline包 ......
1、MYSQL的安装
1)首先当然是下载源码包咯,如:mysql-5.0.27的安装,http://www.mysql.com
2)解压缩,>tar -zxvf mysql-5.0.27.tar.gz
3)解压完成,进入mysql-5.0.27文件夹,>cd mysql-5.0.27
4)安装配置,>./configure --prefix=/opt/mysql --with-extra-charsets=all --with-unix-socket-path=/opt/m ......
2、APACHE的安装
1)当然还是下载源码包,如:httpd-2.0.55.tar.gz,地址自己找……
2)解压缩,>tar -zxvf httpd-2.0.55.tar.gz
3)进入解压后的httpd-2.0.55,>cd httpd-2.0.55
4)安装配置,>./configure --prefix=/opt/apache --enable-cgi
5)编译,>make
6)安装,>make install
......
4、mcrypt安装
1)安装mcrypt之前,必须安装libmcrypt和mhash,先去http://www.sourceforge.net
下载Libmcrypt,mhash,mcrypt安装包
2)先安装Libmcrypt
>tar -zxvf libmcrypt-2.5.8.tar.gz
>cd libmcrypt-2.5.8
>./conf ......
1、下载phpMyAdmin至web服务器目录并重命名为:phpmyadmin。假设服务器目录为www,则存放位置为www/phpmyadmin,访问路径为http://localhost/phpmyadmin
2、复制"/phpmyadmin/libraries/"目录下的"config.default.php"文件至"/phpmyadmin/"目录下,并重命名为"config.inc.php"
3 ......