i want call a java class file (no gui) from a vb application.
the java class will output some text on screen and i want to redirect the output to the vb program.
is there any ways to do it?
thanks~
Printable View
i want call a java class file (no gui) from a vb application.
the java class will output some text on screen and i want to redirect the output to the vb program.
is there any ways to do it?
thanks~
I don't know much baout Java, but if you can run the class from the command prompt, then you can use the Process.Start() to run the class.
Though getting the output would be even more difficult.
Since .Net and Java are fairly similar, why not port the class? That would eliminate another dependency your app would have and keep it running quicker because it's in 1 application instead of two.
You cannot directly access a Jave class in your .NET app. You can execute any executable, Java or otherwise, using Process.Start, but you cannot access Java objects directly within your .NET code. You can create a ProcessStartInfo object and set its RedirectStandardOutput to True, pass it to Process.Start and save the Process object it returns, then read from the StandardOutput stream of the Process. You should read about the Process and ProcessStartInfo classes.
I see. That really what I want to do.Quote:
Originally Posted by jmcilhinney
But I have another question.
How can I check whether a JRE program is installed in the machine from the vb.net program?
Or I can only check the environment variables "JAVA_HOME" instead?