Runtime.exec(String[]cmds)出现的问题

今天使用Runtime.exec(String[]cmds)这个方法时,出现了一个IOException异常.
java.io.IOException: Cannot run program "D:/eclipse/BIN/T3Enc.exe -enc D:\TTCN Project\MYTEST\forder\bbsd\xxx.3mp C:\1\forder\bbsd\xxx.3mp.enc": CreateProcess error=123, ????????????ò?í±ê

改为Runtime.exec(cmds[0])无异常,仔细跟踪进去发现很奇怪啊.

String[] cmdarray = command.toArray(new String[command.size()]);
for (String arg : cmdarray)
if (arg == null)
throw new NullPointerException();

通过Eclipse调试观察,Watch窗口中明明command.toArray(new String[command.size()])返回一个大小为1的不为空的数组,但是到了下面直接抛出空指针异常.
不明白,标记下,回去好好看看!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
if (Objects.equals(topicArr[0], "IOT")){ if (Objects.equals(topicArr[3], "state")) { re_state.put(topicArr[2], topicArr[4]); }else if (Objects.equals(topicArr[3], "sensorTag")) { String a = "1"; // Device cmds = JSON.toJavaObject((JSON) JSON.parse(_msg), Device.class); // String address = ApiController.getAddress(cmds.getLocation())[0]; // address = address.substring(0, address.length() - 1); // Deviceupdate cmd = JSON.toJavaObject((JSON) JSON.parse(_msg), Deviceupdate.class); // cmds.setLocation(address); // cmd.setLocation(address); // Location location = new Location(); // location.setLocation(cmds.getLocation()); // location.setId(cmds.getId()); // cmds.setRecordTime(new Date()); // cmd.setRecordTime(cmds.getRecordTime()); // if (deviceupdateService.selectDeviceupdateById(cmds.getId()) == null) { // //向Mysql添加设备信息 // deviceService.insertDevice(cmds); // deviceupdateService.insertDeviceupdate(cmd); // locationService.insertLocation(location); // //向redis添加设备信息 // redisTemplate.opsForValue().set(cmds.getId(), _msg); // // System.out.println("数据存放成功"); // } else { // locationService.updateLocation(location); // //向redis添加设备信息 // redisTemplate.opsForValue().set(cmds.getId(), _msg); // //向Mysql添加设备信息 // deviceService.insertDevice(cmds); // deviceupdateService.updateDeviceupdate(cmd); // // System.out.println("更新完成"); // System.out.println(cmds); // } }else if (Objects.equals(topicArr[3], "test")){ }
最新发布
06-09

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值