![](/img/trans.png)
[英]How do I view source code of built-in classes in Java (e.g. BigInteger etc.)?
[英]How can i navigate (e.g. open Mozilla) in a Remote Desktop by using java code written in eclipse?
我希望能夠在遠程桌面中打開Mozilla Firefox,並能夠在Mozilla中“播放”(訪問URL,從遠程桌面連接的“桌面”導入)。 所有這些,我希望它們能夠自動執行。 這就是為什么我在eclipse中創建了Java代碼的原因。 到目前為止,我已經能夠自動訪問遠程桌面連接。 請找到我為此使用的代碼:
public static void main(String[] args) throws IOException, InterruptedException {
String ip = "xxx.xxx.xx.xx"; //check if this is the desired IP
String userName = "XXX"; //check if this is the correct username
String password = "XXXxxx"; //check if the password has changed
String jacobDllVersionToUse;
jacobDllVersionToUse = "jacob-1.18-x64.dll";
File file = new File("lib", jacobDllVersionToUse);
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
// creating credentials
Process p = Runtime.getRuntime().exec("cmdkey /generic:"+ip+" /user:"+userName+" /pass:"+password );
p.destroy();
Process p2 = Runtime.getRuntime().exec("mstsc /v: "+ip+" /f /console");
AutoItX x = new AutoItX();
x.winWaitActive("Remote Desktop Connection");
x.controlClick("Remote Desktop Connection", "Co&nnect", "1");
x.winWaitActive("Remote Desktop Connection");
x.controlClick("Remote Desktop Connection", "Co&nnect", "1");
}
您能協助我如何通過eclispse在遠程桌面中打開Mozilla嗎?
先感謝您!
我假設代碼成功激活了RDP窗口。
一旦激活,AutoIt將無法識別窗口中的元素控件,但是您仍然可以使用Java Robot甚至AutoIt發送鍵盤命令。
要啟動Firefox,請發送Window + R,然后傳遞firefox.exe的路徑(“ C:\\ Program Files \\ Mozilla Firefox \\ firefox.exe”)並發送ENTER。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.