<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Comments for Java COM Automation with Jacob and JBuilder - by Yuri Marx</title>
<link rel="alternate" type="text/plain" href="http://dn.codegear.com/article/33305" title="Java COM Automation with Jacob and JBuilder - by Yuri Marx" />
<link rel="self" type="application/atom+xml" href="http://dn.codegear.com/article/33305/feed" title="Comments for Java COM Automation with Jacob and JBuilder - by Yuri Marx" />
<id>http://dn.codegear.com/article/33305</id>
<updated>2008-10-07T20:47:39-07:00</updated>
<entry>
<title>Java COM Automation with Jacob and JBuilder</title>
<author>
<name>George Kmitec</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=41280</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=41280</id>
<updated>2008-07-15T19:07:53-07:00</updated>
<published>2008-07-15T19:07:53-07:00</published>
<summary>Java COM Automation with Jacob and JBuilder</summary>
<content>I am using JACOB in java scriplets running under Tomcat with MS WMI classes like WIN32_ and CIM_ for remotely connected PCs.All works fine for simple cases, but...1)       I am not able to copy a file with CIM_Datafile class from remote to local machine:&lt;%@ page import=&quot;com.jacob.com.*&quot; %&gt;&lt;%@ page import=&quot;com.jacob.activeX.*&quot; %&gt;&lt;% String user=&#8221;xxx&#8221;; String Password=&#8221;yyy&#8221;; String directoryName = &quot;C:\\Temp&quot;; String COMPNAME=&#8221;zzz&#8221;;  ActiveXComponent locator = new ActiveXComponent(&quot;WbemScripting.SWbemLocator&quot;);   Dispatch services = locator.invoke(&quot;ConnectServer&quot;,new Variant(COMPMNAME),   new Variant(&quot;root\\cimv2&quot;),new Variant(user),new Variant(password)).toDispatch();  String query = &quot;ASSOCIATORS OF {Win32_Directory='&quot; + directoryName + &quot;'} &quot; + &quot;WHERE AssocClass=CIM_DirectoryContainsFile ResultClass=CIM_DataFile ResultRole=PartComponent Role=GroupComponent&quot; ;   Dispatch objectSet = Dispatch.call(services, &quot;ExecQuery&quot;, query).toDispatch();    EnumVariant enumval = new EnumVariant(objectSet);     while (enumval.hasMoreElements()) {                 Dispatch item = enumval.Next().toDispatch();                     String name = Dispatch.get(item, &quot;Caption&quot;).toString();                  out.println(name +&quot;&lt;BR&gt;&quot;);                if(name.equals(&quot;c:\\temp\\test.txt&quot;)){                         String copyFile= &quot;c:\\Temp\\new\\ test.txt &quot;;                         Variant copy_retcode=   Dispatch.call(item,&quot;Copy&quot;,copyFile,null);                         out.println(copy_retcode +&quot;&lt;BR&gt;&quot;);   }%&gt;The code above works and copies test.txt on remote machine &lt;COMPNAME&gt; from c:\\Temp to c:\\Temp\\newDo you know a way of how to copy it from remote &lt;COMPNAME&gt; to local machine?2)       I am trying to get registry values on remote machine by using EnumValues method of StdRegProv in WMIFor VB it described in details in: http://safari.oreilly.com/9780735622975/ch17lev1sec4#X2ludGVybmFsX1NlY3Rpb25Db250ZW50P3htbGlkPTk3ODA3MzU2MjI5NzUvY2gxN2xldjFzZWM4Converting into Java/Jacob I have:int             HKLM = &quot;0x80000002&quot;;String strKeyPath = &quot;SOFTWARE\\ODBC&quot; ;   ActiveXComponent locator = new ActiveXComponent(&quot;WbemScripting.SWbemLocator&quot;);    Dispatch services = locator.invoke(&quot;ConnectServer&quot;,new Variant(COMPNAME), new Variant(&quot;root\\default&quot;),new Variant(user),new Variant(password)).toDispatch();   Dispatch oReg = Dispatch.call(services, &quot;Get&quot;, &quot;StdRegProv&quot;).toDispatch();    Variant     ret = new Variant ();   ret= Dispatch.call(oReg, &quot;EnumKey&quot;, HKLM, strKeyPath );     out.println( &#8220;ret=&#8221;+ret  +&quot;&lt;BR&gt;&quot;);it returns 0 &#8211; means OK, but I do not know how to retrieve results going to the arrSubKeys parameter of VB original code:objReg.EnumKey HKLM, strKeyPath, arrSubKeysThanks in advance.</content>
</entry>
</feed>
