应该没有通用代码,java又不是专给微软做的

解决方案 »

  1.   

    用java的API只能用System.getProperty()获得:os.name Operating system name 
    os.arch Operating system architecture 
    os.version Operating system version 这三个关于os的参数。
      

  2.   

    晕  这几个 key 怎么输入啊  System.getProperty(oa.name)  错了啊  OA 是个 什么类啊
      

  3.   

    哦  谢谢  还有个 小问题
       Runtime.getRuntime().exec("cmd /c start winword \"" + filePath + "\"");
       这个是在2000,XP下能运行
       Runtime.getRuntime().exec("command /c start winword \"" + filePath + "\"");
       那这个怎么就不能在98下 就不能在98下啊
      

  4.   

    to launch401(宁静温泉) :
        System.getProperty("os.name");
    打出来的是 NULL 啊
                                         晕死
      

  5.   

    可以做个.bat,在Java里面打开这个bat文件
      

  6.   

    http://www.javaworld.com.tw/jute/post/view?bid=29&id=9569&sty=3&age=0&tpg=1&ppg=1
      

  7.   

    System.getProperty(  "os.name  ");这个方法是可以的   是我自己 打错了 打成了 oa.name  呵呵  再次感谢 launch401(宁静温泉) 根据自己总结   给大家写一个JAVA获取运行机子上的信息的  呵呵 
    Properties pro=System.getProperties();
        Set set=pro.keySet();
        Iterator it=set.iterator();
        while(it.hasNext()){
          String key=(String)it.next();
          System.out.println(key+"="+(String)pro.get(key));
        }
        
      

  8.   

    //使用jacob··········
    import com.jacob.com.*;
    import com.jacob.activeX.*;public class openword
    { public static void open(String paths)
    {
    System.out.println("In open......");

    ActiveXComponent app = new ActiveXComponent("Word.Application");//启动word

    String inFile = paths;//word file to open

    try 
    {
    app.setProperty("Visible", new Variant(true));//设置word可见
    Object docs = app.getProperty("Documents").toDispatch();
    Object doc = Dispatch.invoke(docs,"Open", Dispatch.Method, 
    new Object[]{inFile,new Variant(false), new Variant(true)}, 
    new int[1]).toDispatch();//打开word文件

    catch (Exception e) 
    {
    e.printStackTrace();

    System.out.println("over!...");
    }

    public static void main(String[] args)
    {

    String paths = new String("D:\\test\\word\\test.doc");

    open(paths); }
    }
      

  9.   

    没事吧,怎么着也不知道?没用过win98么?cmd这个命令98没有,2000以后才出来的,win98只有command,一样的
      

  10.   

    to  guoxiaoshou2000(狼骑兵)    JAVA操作JNI 这个jacob 很方便吗 哪里有下啊