从Java应用程序中安装和访问Nuget软件包中的类

发布于 2025-01-21 07:53:17 字数 76 浏览 4 评论 0原文

我创建了一个Nuget软件包(.NET标准2.0和.NET Framework 4.8-兼容性),我想知道是否可以从Java应用程序访问。

I have created a NuGet package (.Net standard 2.0 and .Net Framework 4.8 - compatibility) that I would like to know if it is possible to access from a Java application.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苄①跕圉湢 2025-01-28 07:53:17

Nuget是.NET中使用的包装格式。不在爪哇。 Java为此而受苦。
因此,没有简单的方法(或我建议的任何方法)可以轻松地使用Java中的代码。

但是,如果您确实需要使用软件包中的方法,则可以尝试执行以下操作:

  1. 编译软件包包含的代码,以便您有.dll文件
  2. 尝试使用Java中的DLL。我不知道太多的爪哇-a-java-program“>如何在Java程序中调用DLL中的方法

基本上您应该能够调用DLL中定义的方法。您可以在.NET中做类似的事情。可以采用DLL,并从.NET知道方法签名中称其为.NET。它被称为

”请注意,Nuget软件包实际上是一个ZIP存储库。您可以使用任何ZIP工具打开它,可以将其提取并使用dotnet命令编译代码。

Nuget is a package format that is used in .NET. Not in Java. Java has Maven for that.
So there is no simple way (or any way I could recommend) to use the code easily in Java.

But if you really need to use the methods you have in the package, you can try to do the following:

  1. Compile the code that the package contains, so that you have .dll file
  2. Try to make use of the compiled dll in Java. I don't know much Java but it seems this is already answered in Stack Overflow: How to call a method in DLL in a Java program

Basically you should be able to call the methods defined in your DLL. Similar thing you can do in .NET. It is possible to take a dll, and call it's methods from .NET knowing the method signature. It is called Interoperability

Also please note that the nuget package is a zip repository in fact. You can open it using any zip tool, you can extract it and compile the code with dotnet command.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文