English 中文(简体)
Invoke进程如何打破行动?
原标题:how to Invoke process action aftter creating it?
  • 时间:2012-05-16 19:45:34
  •  标签:
  • java

i 撰写简单类别,形成一种过程,希望利用这一进程能够做的(方法)方法,并且知道如何做。

我的简单方法是:

 public void initProcesses()
    {
        Process pA;
        Process pB;
        Process pC;

        try 
        {
            pA = Runtime.getRuntime().exec("java -cp ProccesA.java ");
                    Class<ProccesA> a = pA.getClass<ProccesA>();
        } 
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

现在,我并不真心知道,是否通风会提供帮助(我知道,我可以改用面粉),但我需要这样做,以便解决我的问题。

是否有人建议如何利用我的职业资格证明书。

感谢

问题回答

Runtime.exec() is usually meant to start non-Java processes from within Java. It is not possible to access anything within that process (except things like stdout and stderr).

或许你希望这样做:

ProcessA instance = new ProcessA();
instance.someMethod();

正如其他人指出的那样,你可以在另一个过程中直接把方法引向 Java物体。

然而,您可使用Java RMI,或利用sockets建立自己的类似接口。

然而,鉴于机构间通信使守则复杂化,而且有许多履约管理费用,是否真正需要一个单独的程序来仔细考虑。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签