带有可执行 jar 的 Java 项目;运行并从中检索数据

发布于 2024-12-16 16:22:21 字数 731 浏览 3 评论 0原文

在工作中,我使用 Java 应用程序(我在 C 驱动器上找到了已编译/可执行的 jar)。我希望能够通过代码从此应用程序中获取一些信息。应用程序本身可能不存储信息,因此它必须以某种方式与遗留系统进行通信,我不确定如何,我已经看到了 Servlet 的痕迹(?)因此,我怀疑该应用程序也有内置的“加密”( ?)

我不想参与加密和登录过程等,所以我想我可以围绕当前可执行 jar 构建一个 Java 项目,然后像平常一样启动应用程序(通过“主”入口点) ,“Start.jar”,但执行后调用我想要的功能(即应用程序像往常一样在后台运行)...

这可能吗?有其他方法吗?例如,可以连接到已执行的 Java 应用程序并发出命令吗

?到目前为止我已经尝试过

  1. 下载Eclipse,并创建了一个新项目
  2. 使Eclipse“引用”外部jar(Eclipse中有一个向导)
  3. 在我的新项目中创建了一个新类,在其中我启动了“主”入口点main”可执行jar(所有jar的结构弹出与“IntelliSense”一起)。我还发现我需要使用 JD-GUI(Java 反编译器)向主程序提供哪个参数...

似乎从主程序内部调用了另一个程序,该程序驻留在不同的 jar 中, Eclipse 的调试窗口我只看到一个错误,这让我怀疑我当前的方法是否可行......也许问题的出现是因为命令是从编译的 jar 发出的? “类路径”可能有问题吗?这看起来像是一个解决方案吗?但话又说回来,我没有 Java 经验(主要是 VBA 和一些 C#)。

At work, I use a Java application (I have located compiled/executable jars on the C-drive). I want to be able to grab some information from this application through code. The application itself probably does not store information, so it must communicate with legacy systems some way, I am not sure how, I have seen traces of a Servlet(?) Hence, I suspect the application also has built-in "encryption"(?)

I do not want to get involved in encryption and login procedures etc., so I am thinking I could just build a Java project around the current executable jars, and launch the application as I usually do (through the "main" entry point, "Start.jar", but then after execution call the functions that I want to (i.e. the application just runs as usual in the background)...

Would that be possible? Is there another way? Can one, for example, hook up to an already executed Java application and issue commands?

What I have tried so far

  1. Downloaded Eclipse, and created a new project
  2. Made Eclipse "reference" external jars (there was a wizard in Eclipse)
  3. Created a new class in my new project, in which I launch the "main" entry point of the "main" executable jar (the structure of all the jars pops up with "IntelliSense"). I have also found out which argument I need to supply to the main procedure using JD-GUI (Java Decompiler)...

It seems that from inside the main procedure a call is made to another procedure, which resides in a different jar, in the debug window of Eclipse I just see an error, which made me doubt that my current approach is viable... Maybe the problem arises because the command is issued from a compiled jar? Could there be an issue with the "class path"? Does this at all seem like a solution? But then again, I have no experience with Java (mostly VBA and some C#).

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

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

发布评论

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

评论(2

是伱的 2024-12-23 16:22:21

您可以使用选项启动应用程序的 JVM,从而启用远程调试。然后你可以将 eclipse 调试器连接到这个 JVM。

http://www.eclipsezone.com/eclipse/forums/t53459.html

You can start your JVM for the application with options, which enable remote debugging. Then you can connect the eclipse debugger to this JVM.

http://www.eclipsezone.com/eclipse/forums/t53459.html

萌面超妹 2024-12-23 16:22:21

根据您的问题,我猜测您的应用程序没有可用于编码的 Java API。当然,这是最简单的方法。因此,如果您还没有检查过,请先检查一下。

假设您没有可用于编码的 API,我认为您的方法是正确的。但这可能很难做到,因为你基本上是在盲目地试图弄清楚应用程序在做什么。远程调试可能会解决部分问题。

如果您确定它正在通过网络发送请求,则可能有一个稍微简单的解决方案。您可以使用 Wireshark 等工具来查看它正在创建的内容。然后,您可以让应用程序创建类似的请求并将它们发送到该目的地。当然,这假设请求未加密。在这种情况下,你可能就不走运了。

Based on your question, I am going to guess that your application does not have a Java API you can code against. That would, of course, be the easiest way. So, if you have not checked, do that first.

Assuming you don't have an API to code against, I think your approach is correct. But it could be hard to do, since you are basically flying blind trying to figure out what the application is doing. Remote debugging might solve part of that problem.

There might be a slightly easier solution, if you are sure it is sending requests across the network. You can use a tool like Wireshark to see what it is creating. Then, you can have your application create requests that look like that and send them to that destination. This assumes of course that the requests aren't encrypted. In that case you are probably out of luck.

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