简体   繁体   English

如何使我的应用程序(.jar)在最终用户的桌面上工作

[英]how to make my application (.jar) works on end-user's desktop

I'm using NetBeans 8.0 and my problem is when I make (clean and build) to my java project....the jar will be build in the current path of the project and works good with no problems, But, when I make a copy of the jar to my desktop, the application jar doesn't run. 我使用的是NetBeans 8.0,我的问题是当我对Java项目进行构建(清理并构建)时。...该jar将在项目的当前路径中构建并且可以正常工作,但是没有问题,但是,当我进行构建时将jar的副本复制到我的桌面上,应用程序jar不会运行。 why? 为什么?

Except for the most trivial programs you cannot just copy a jar file containing your classes to a target machine and expect it to run, as Sun never got around to do a well-defined single-file deployment method for a desktop application (similar to what WAR files do for web applications). 除了最琐碎的程序之外,您不能仅将包含类的jar文件复制到目标计算机并期望它运行,因为Sun从来没有绕过为桌面应用程序定义明确的单文件部署方法(类似于WAR文件适用于Web应用程序)。

You must essentially copy your code, and the library jars you depend on, and a launcher script telling the JVM which jars you have, and an icon if you want that and usually more too. 本质上,您必须复制代码,所依赖的库jar,告诉JVM哪些jar的启动程序脚本以及是否需要图标(通常还会更多)。 The lack of a standard method means that there are many ways to do it and you need to choose the one best suitable for you. 缺乏标准方法意味着有很多方法可以做到,因此您需要选择最适合您的方法。

A solution for your problem here and now is to look at https://netbeans.org/kb/articles/javase-deploy.html which discusses how to deploy Java SE applications using netbeans by creating a runnable jar with an embedded classpath. 解决您当前问题的方法是查看https://netbeans.org/kb/articles/javase-deploy.html ,其中讨论了如何通过创建带有嵌入式类路径的可运行jar来使用netbeans部署Java SE应用程序。 I am not very familiar with Netbeans but the steps look very sensible and will teach you the details on the process. 我对Netbeans不太熟悉,但是这些步骤看起来非常明智,并且可以教您有关该过程的详细信息。

When you get more experienced you will want to be able to automate the process more. 当您有更多经验时,您将希望能够使该过程更加自动化。 The first step in that direction is to learn Maven - a bit tedious in the start but it pays of in the long run. 朝这个方向迈出的第一步是学习Maven-一开始有点乏味,但从长远来看却值得。

暂无
暂无

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

相关问题 如何保存我的Android应用程序,以便最终用户可以在没有Android SDK的情况下执行它 - How can I save my Android application so that the end-user can execute it without the Android SDK 我从.jar制作了Mac OSX应用程序。 最终用户需要Java吗? - I made a Mac OSX app from .jar. Does end-user need Java? BKM向最终用户交付基于Web的Java应用程序+ Jetty + JRE - BKM to deliver a web-based java application + Jetty + JRE to end-user 如何在Java中将桌面应用程序转换为Web应用程序 - how to make my desktop application to web app application in java 如何显示从API到最终用户的错误消息? - How can I show error message from API to the end-user? 如果我在我的项目中使用 Zulu JDK 13。 如果最终用户从 oracle 安装了 JRE,他们是否能够使用我的程序? - If I use Zulu JDK 13 for my project. Will end-user be able to use my program if they have installed JRE from oracle? 如何确定我的网站/网页在用户桌面上是否处于活动状态 - How to identify if my website/webpage is active on a user's desktop 如何使用izpack将我的jar应用程序安装到安装程序? - how to use izpack to make my jar application to installer? JNLP - 如何部署运行的应用程序并创建用于启动a.jar的桌面图标? - JNLP - How can i deploy my application which runs and create a desktop icon for launching the a.jar? 如何使桌面应用程序模块化? - How to make a desktop application modular?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM