如何从正在运行的项目(特别是在 NetBeans 中)以及桌面应用程序中运行另一个 Java 项目?
我有一些数据库应用程序(CRUD),我想创建一个带有一些按钮的桌面应用程序,以便单击它们来运行这些应用程序。我怎么能这样做呢?
我尝试将 CRUD 项目添加为桌面应用程序的类路径,但没有成功,CRUD 行中出现异常,指示找不到类或其他内容。
我正在使用 NetBeans,这些数据库应用程序是 NetBeans 从我的 MySQL 服务器自动创建的。
I have some database applications (CRUD), and I want to create a desktop application with some buttons such that clicking on them lead to run those applications. How could I do this?
I have tried adding the CRUD projects as class path for the desktop application, but it didn't work out, with an exception in CRUD's lines indicating a class can not be found or something.
I'm using NetBeans and those database applications were created automatically by NetBeans from my MySQL server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我找到了一个解决方案,虽然这不是我想要的,但它有效。
首先,我将所有数据库应用程序构建为 JAR 文件。
接下来,在按钮的事件处理程序中,我添加了这行代码以执行 JAR 文件:
因此,每次单击按钮时,应用程序都会运行。
虽然这对我来说效果很好,但这似乎不是正确的解决方案。我更喜欢添加类路径或类似的解决方案,但由于类名中存在一些冲突,我不知道它们来自哪里,类路径不起作用。
OK, I found a solution on this although this is not what I wanted, but it's working.
First, I built all the database applications as JAR files.
Next, in the event handler of my buttons I added this line of code in order to execute the JAR file:
So every time I click the button the application runs.
Although this is working fine for me, but it seems not to be the right solution. I rather prefer solutions like adding classpaths or similar, but because of some conflict in the class name, that I don't know where they come from, classpaths didn't work.