Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting environment variables

Status
Not open for further replies.

jbrowne

Programmer
Feb 1, 2000
182
IE
Hi all,

Is there a way to set environment variables (eg path and classpath of the machine) from VB6 code.

Thanks
John B
 
Classpath? You sneaky Java coder you...

Check out SetEnvironmentVariable in the API.
 
Thanks for that - and seeing that you found me out, is there a way of calling the java compiler from VB and if there is, can a compile error in the Java be fed back to VB - in other words what I'm trying to do cut out the use of a batch file to do the above.

Thanks again in advance
John B
 
Oooh! Narsty!!!

You can certainly invoke the Java Compiler - just use the Shell function specifying javac and it's command line arguments...

As for getting the output from that, if this is a single user system, you might consider adding " > c:\results.txt" to the value you use in Shell. That should write the output to a results.txt file, which you could then open and read with VB. It's not all that elegant though, is it?

mmilan.
Ps. I'm beginning Java - reading the tutorials as we speak...
 
Thanks again for your suggections mmilan - I'm only getting back to this now, got side-tracked on another project. The only problem I see with this is as follows;
What I hope to achive is to be able to compile a number of java programs one by one from a grid. In doing so I need to know when one is finished compiling before I call the next one so as not to keep calling the compiler as it is compiling previous programs if you see what I mean. So basically my question is - I call the first program with the compiler as you suggest above - how do I get VB to wait until the compile is complete before calling the second one and so on.

Thanks again in advance
John B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top