|
-
Jun 12th, 2006, 09:39 PM
#1
Thread Starter
New Member
Run java program from VB.net
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~
-
Jun 12th, 2006, 09:45 PM
#2
Re: Run java program from VB.net
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.
-
Jun 12th, 2006, 09:50 PM
#3
Re: Run java program from VB.net
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.
-
Jun 12th, 2006, 09:58 PM
#4
Thread Starter
New Member
Re: Run java program from VB.net
 Originally Posted by jmcilhinney
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.
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?
-
Sep 1st, 2012, 12:18 PM
#5
New Member
Re: Run java program from VB.net
 Originally Posted by jmcilhinney
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.
can u please write a detailed code of it in .net
-
Sep 1st, 2012, 09:52 PM
#6
Re: Run java program from VB.net
 Originally Posted by sanjeev467
can u please write a detailed code of it in .net
There's an example in the VB.NET CodeBank forum, posted by gigemboy.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|