怎么在98、2000、XP的WINDOW系统下 用JAVA代码打开WORD文档啊????????? 应该没有通用代码,java又不是专给微软做的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用java的API只能用System.getProperty()获得:os.name Operating system name os.arch Operating system architecture os.version Operating system version 这三个关于os的参数。 晕 这几个 key 怎么输入啊 System.getProperty(oa.name) 错了啊 OA 是个 什么类啊 哦 谢谢 还有个 小问题 Runtime.getRuntime().exec("cmd /c start winword \"" + filePath + "\""); 这个是在2000,XP下能运行 Runtime.getRuntime().exec("command /c start winword \"" + filePath + "\""); 那这个怎么就不能在98下 就不能在98下啊 to launch401(宁静温泉) : System.getProperty("os.name");打出来的是 NULL 啊 晕死 可以做个.bat,在Java里面打开这个bat文件 http://www.javaworld.com.tw/jute/post/view?bid=29&id=9569&sty=3&age=0&tpg=1&ppg=1 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)); } //使用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); }} 没事吧,怎么着也不知道?没用过win98么?cmd这个命令98没有,2000以后才出来的,win98只有command,一样的 to guoxiaoshou2000(狼骑兵) JAVA操作JNI 这个jacob 很方便吗 哪里有下啊 大厅自助终端,读取身份证信息 javax.swing.JTable的模式问题。 生成的数组太大,内存不够用该怎么办??就这20分了 线程同步问题,不知道如何处理。各位大虾帮忙看一下 解释下Collections.synchronizedList()都作了哪些工作? 要跳了,广州的进来看看,做个小调查,给个意见 java中如何实现在忙操作时鼠标变为漏斗状 菜鸟问问关于JBuilder的问题 页面刷新问题。不刷新得不到最新的结果。 Java中子类构造调用父类构造之前写代码会报错 这个算法怎么做? applet不能浏览
os.arch Operating system architecture
os.version Operating system version 这三个关于os的参数。
Runtime.getRuntime().exec("cmd /c start winword \"" + filePath + "\"");
这个是在2000,XP下能运行
Runtime.getRuntime().exec("command /c start winword \"" + filePath + "\"");
那这个怎么就不能在98下 就不能在98下啊
System.getProperty("os.name");
打出来的是 NULL 啊
晕死
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));
}
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); }
}