Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Build Java Application as Executable JAR
How to build a Java application as an executable JAR file? I want to use the "java -jar" command to launch the application.
✍: FYIcenter
The first step to build your own JavaWS/JNLP application is to
build it as an executable JAR file as shown in this tutorial:
1. Create your Java application, HelloJavaWs.java:
// Copyright (c) FYIcenter.com import javax.swing.*; public class HelloJavaWs { public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Hello JavaWS!"); frame.setBounds(100,100,350,150); frame.setVisible(true); } }
2. Compile and test it:
>\fyicenter\jdk-1.8.0\bin\javac HelloJavaWs.java >\fyicenter\jdk-1.8.0\bin\java HelloJavaWs (You see a new application window named as "Hello JavaWS!")
3. Create a manifest file, META-INF\MANIFEST.MF, with two lines:
Main-Class: HelloJavaWs
4. Build the executable JAR file, HelloJavaWs.jar:
>\fyicenter\jdk-1.8.0\bin\jar -cvf HelloJavaWs.jar HelloJavaWs.class added manifest adding: HelloJavaWs.class(in = 477) (out= 316)(deflated 33%) >\fyicenter\jdk-1.8.0\bin\jar -uvmf META-INF\MANIFEST.MF HelloJavaWs.jar updated manifest
5. Test the executable JAR file, HelloJavaWs.jar:
>\fyicenter\jdk-1.8.0\bin\java -jar HelloJavaWs.jar (You see a new application window named as "Hello JavaWS!")
Now your application is ready to be deployed with JavaWS and JNLP. See the next tutorial on a JNLP file for the application.
⇒ Create JNLP File for Java Application
⇐ Building Your Own JavaWS and JNLP Application
2017-12-26, 971🔥, 0💬
Popular Posts:
What Is log4j-1.2.13.jar? I got the JAR file from logging-log4j-1.2.13.zip .log4j-1.2.13.jar is the ...
What Is wstx-asl-3.2.8.jar? wstx-asl-3.2.8.jar is JAR file for the ASL component of Woodstox 3.2.8. ...
What Is mail.jar of JavaMail 1.4.2? I got the JAR file from javamail-1.4.2.zip. mail.jar in javamail...
How to download and install ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is a Java 5 J...
commons-io-1.4.jar is the JAR file for Commons IO 1.4, which is a library of utilities to assist wit...