vnc 实现远程连接总结
有两种方式:
①Websockify代理
②命令
- Websockify代理
通过novnc实现vnc的远程
参考链接:https://blog.csdn.net/lululuyang/article/details/122345529
- 命令
通过命令vncviewer.exe ip地址
实现vnc远程 ,注意该命令的执行前提:需要找到vnc的安装目录才可执行
public static void main(String[] args) {
String serviceName = "WinVNC4";
String installDir = null;
try {
Process process = Runtime.getRuntime().exec("cmd /c sc qc " + serviceName);
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
if (line.trim().startsWith("BINARY_PATH_NAME")) {
String[] path = line.trim().split("\"");
if (path.length > 1) {
File file = new File(path[1]);
installDir = file.getParent();
break;
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Service " + serviceName + " is installed in " + installDir);
}