Running Java Class Within VB.NET

I'm not very familar with Java and have a need to run a class passing parameters from within Visual Basic.NET 2010.

The class that needs to be run is "resources.schedulerjobs.AutoPrescriptionMonitorJob". A few of the parmeters that need to be passed are things like BEGINDATE. ENDDATE and XMLPATH.

Is there a way to do this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


You can run java in the same way as any external command:

using the command

java resources.schedulerjobs.AutoPrescriptionMonitorJob  01-06-2012 01-07-2012 c:\path_to_file

witrh the she'll or start process command


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You need to make sure that java is installed on your machine and then either to be sure that
the CLASSPATH vvariable is pointing to your classses or specify
-cp ....

and paths to all your lcasses and jars afte -cp on the command likne
which you put on your lain

-cp ...

should conmme before your class which you want to execute
vbplayerAuthor Commented:
Ok. I found the CLASSPATH that JAVA would be using, see below. The next question is about the parameters. The java program is expecting named parameters in no special order. example: BEGINDATE=01/01/2011, ENDDATE=01/31/2011, XMLPATH=C:\SOMPLACE. In the example you gave me above you just supplied the parameter data. Would I need to actually code it like 'BEGINDATE=01/01/2011' to pass the whole parameter to JAVA?

CLASSPATH: medispan.wkconfig.xml;medispan.dib.wkconfig.xml;medispan.wkconfig.x
käµfm³d 👽Commented:
Use the Process class to launch the Java executable, and pass that executable the appropriate parameters:

System.Diagnostics.Process.Start("java.exe", "resources.schedulerjobs.AutoPrescriptionMonitorJob BEGINDATE ENDDATE XMLPATH")

Open in new window

If java is reading the whole line BEGINDATE=01/01/2011 just put it this way on the command line
If there were embedded spaces you would need the quotes around parameter, but with equal sign it should be OK

I suggest that you first open cmd window and try to execute your java code from the cmd command line - then
use the way itworks to provide the line in the VB.NET code
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.