Delphi代码到Java的转换

发布于 2024-08-06 08:52:13 字数 1539 浏览 6 评论 0 原文

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

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

发布评论

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

评论(4

南七夏 2024-08-13 08:52:13

我不知道有这样的转换器,但请记住,这样的转换只能让您到目前为止。

例如,Visual Studio 附带了一个 Java 到 C# 的转换程序。它做得非常出色,但根据我的经验,对于除了最琐碎的示例之外的任何事情,您仍然需要自己进行大量清理/重构。此外,原始语言中的糟糕代码通常会转换为新语言中同样糟糕或可能更糟糕的代码。所以代码会很难维护。

关键是天下没有免费的午餐。即使使用转换器,您很可能也必须自己进行大量移植。如果这是不可能的(由于时间、金钱等原因),你可能不得不重新考虑该项目。

很抱歉,我无法向您指出一个有用的工具(希望其他人会),但我已经看过这些项目几次,人们通常会对转换后所需的清理工作感到惊讶。

I am not aware of such a converter, but keep in mind that such conversions will only get you so far.

For instance there's a Java to C# convert that ships with Visual Studio. It does an excellent job, but for anything beyond the most trivial example you still have to do a lot of cleanup/refactoring yourself in my experience. Also, bad code in the original language will usually get converted to just as bad or possible worse code in the new language. So the code will be hard to maintain.

The point is there's no free lunch. Even with a converter you most likely will have to do a significant bit of porting yourself. If that is out of the question (due to time, money, whatever) you may have to rethink the project.

I am sorry I could not point you to a useful tool (hopefully others will) but I have seen these projects a couple of times and people are usually surprised by the cleanup work needed after a conversion.

冷夜 2024-08-13 08:52:13

我能想到的最好的解决方案是:找一个 Java 开发人员并进行一些极限编程(你:阅读 Delphi 源代码并向他解释它应该做什么 - 他:用 Java 写下所有内容)

因为即使你找到一个Delphi-to-Java Converter - 它可能会产生错误的源代码。

The best solution I can think of would be: grab a Java-Developer and do some extreme programming (you: reading the Delphi sourcecode and explaining to him what it should do - he: writing all down in Java)

Because even if you find a Delphi-to-Java Converter - it might produce bad sourcecode.

坏尐絯℡ 2024-08-13 08:52:13

Free Pascal 支持 Java 虚拟机 (JVM) 编译:

Java 字节码目标已添加到 Free Pascal 编译器中。

Free Pascal 编译器中添加了新目标。现在是
可以将应用程序编译为 Java 字节码。这意味着
这些 Free Pascal 应用程序可以在 Java 虚拟机中运行
(JVM),这样它就可以运行在任何支持Java的平台上。

然而,该目标仅支持基本的 Pascal 语言和系统单元的部分功能。

Free Pascal supports compilation for the Java Virtual Machine (JVM):

Java-bytecode target added to the Free Pascal compiler.

A new target has been added to Free Pascal compiler. It is now
possible to compile applications to Java bytecode. This means that
these Free Pascal applications can run in a Java Virtual Machine
(JVM), so that it can run on any platform that has Java support.

However, this target does only support the basic Pascal language and some functionality of the system unit.

往事随风而去 2024-08-13 08:52:13

之前有一个叫Delphi2J的程序可以转换,但是我找不到下载的链接。

另一种方法:

  1. 尝试使用 Delphi2CS 将 Delphi 代码转换为 C# 代码,
  2. 然后使用 VB& C# to Java Converter 有demo,我没有尝试。

Before there was a program called Delphi2J to convert, but I couldn't find the link to download it.

Another way:

  1. Try to Convert Delphi code to C# code using the Delphi2CS
  2. Then use VB & C# to Java Converter there is demo, I didn't try it.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文