The invention discloses a calling method and other software based on Eclipse system and storage medium, by creating a new builder object, parameters for the absolute path to execute other executable program; through the implementation of the other programs, acquired a Process object; through the process of the input stream, execute instructions; create a new thread, used to monitor the output stream of the process, when a thread begins executing, monitor other executable program output stream. The invention optimizes the working model of standard output stream and erroneous output stream, reduces the probability of errors and exceptions when calling other programs, and does not cause the problem of output flow blocking, at the same time, it can distinguish the correct information from the wrong information. In addition, the invention also proposes a function to terminate all invalid processes, which greatly reduces the occurrence of a repeated process of establishment and the problem of taking up a large amount of CPU resources.
【技术实现步骤摘要】
基于Eclipse的其他软件调用方法、系统及存储介质
本专利技术涉及嵌入式集成开发
,尤其涉及一种基于Eclipse的其他软件调用方法、系统及存储介质。
技术介绍
随着嵌入式硬件和软件日益复杂,传统基于命令行的开发调试操作已经无法满足日常需求,基于图形化的调试工具成为最流行的选择。Eclipse作为一款良好的开源软件,提供了大量的扩展节点,可供开发自己的功能。现如今,许多嵌入式集成开发环境都是基于Eclipse来实现的。在Eclipse的基础上做嵌入式集成开发环境的开发,其核心是调用其他相关软件以及对产生的相关进程进行管理。在Eclipse中调用其他软件,主要是通过java的Process类实现的,Process类执行时,会有两个结果输出流。一个是标准输出流,输出的是正确的执行结果。一个是错误输出流,输出的是错误的执行结果。如果不对这两个输出流进行处理,只处理标准输出流的话,假如执行过程中出现了错误或者异常,容易造成输出流的阻塞,同时程序也不会继续进行,出现卡死状态。而如果将两个输出流合并成一个输出流的话,虽然可以解决输出流的阻塞问题,但这样错误输出和正确输 ...
【技术保护点】
一种基于Eclipse的其他软件调用方法,其特征在于,包括以下步骤:S1:通过ProcessBuilder()函数新建一个builder对象,参数为要执行的其他可执行程序的绝对路径;S2:通过builder.start()执行该其他程序,获得一个Process进程对象process,process即为打开该其他程序后的进程;S3:通过process.getOutputStream()获得该进程的输入流,通过该输入流执行相应的指令;S4:使用WorkspaceJob创建一个新的线程,用来监听process进程的输出流,通过belongsTo()将该Job归属到一个集合中,之后 ...
【技术特征摘要】
1.一种基于Eclipse的其他软件调用方法,其特征在于,包括以下步骤:S1:通过ProcessBuilder()函数新建一个builder对象,参数为要执行的其他可执行程序的绝对路径;S2:通过builder.start()执行该其他程序,获得一个Process进程对象process,process即为打开该其他程序后的进程;S3:通过process.getOutputStream()获得该进程的输入流,通过该输入流执行相应的指令;S4:使用WorkspaceJob创建一个新的线程,用来监听process进程的输出流,通过belongsTo()将该Job归属到一个集合中,之后通过schedule()将该线程添加到等候线程中,等待操作系统执行该Job;S5:当监听线程开始执行之后,监听其他可执行程序的输出流,如果输出流不为空则输出到自定义的console中;如果输出流为空,则关闭输出流,同时刷新工程所在的工作区间。2.根据权利要求1所述的基于Eclipse的其他软件调用方法,其特征在于,在步骤S4中,所述多线程选择的是Eclipse本身的Job机制,使用的是Job机制的扩展WorkspaceJob。3.根据权利要求1所述的基于Eclipse的其他软件调用方法,其特征在于,在步骤S5中,所述其他可执行程序的输出流有两个结果输出流,一个是标准输出流,输出的是正确的执行结果;一个是错误输出流,输出的是错误的执行结果。4.根据权利要求3所述的基于Eclipse的其他软件调用方法,其特征在于,在步骤S5中,使用一个while循环实现对其他可执行程序的输出流监听,循环的终止条件是标准输出流和错误输出流均为空。5.根据权利要求4所述的基于Ec...
【专利技术属性】
技术研发人员:吴翔虎,曲明成,陶永超,刘全胜,
申请(专利权)人:深圳航天科技创新研究院,
类型:发明
国别省市:广东,44
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。