简体   繁体   English

我可以在VB.NET代码中包含Java代码吗?

[英]Can I include Java code with VB.NET code?

如何在VB.NET代码中包含Java代码?

I'm not sure what you mean, but if you want to run java code inside vb.net or vice versa, the way I would do it is by launching a new java process from VB.net or launching the vb.net app executable from Java (both would require your apps being compiled before launching them, however). 我不确定您的意思,但是如果您想在vb.net内运行Java代码,反之亦然,那么我将通过从VB.net启动新的Java进程或启动vb.net应用程序可执行文件来执行此操作从Java中获取(两者都需要在启动应用之前对其进行编译)。

To launch a new process from Java, consider: 要从Java启动新进程,请考虑:

  • Runtime.exec 运行时

    Example: Runtime.getRuntime().exec("myVBApp.exe"); 示例: Runtime.getRuntime().exec("myVBApp.exe");

  • ProcessBuilder 流程构建器

    Example: ProcessBuilder process = new ProcessBulder("myVBApp.exe"); 示例: ProcessBuilder process = new ProcessBulder("myVBApp.exe");

To launch a new process from VB.Net, consider: 要从VB.Net启动新过程,请考虑:

  • Shell 贝壳

    Example: Shell("java myJavaApp") 示例: Shell("java myJavaApp")

  • Process 处理

    Example: Process.Start("java","myJavaApp") 示例: Process.Start("java","myJavaApp")

All examples would require some more code if you want to do anything more meaningful than just launch the process, but the links ought to point you in the right direction. 如果您想做的事情不仅仅是启动过程,所有示例都将需要更多代码,但是链接应该为您指明正确的方向。

As for your real player plugin question, that probably warrants a separate question. 至于您的真实播放器插件问题,可能需要另外一个问题。 Best to keep each question on one topic. 最好将每个问题都放在一个主题上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM