line !!!The third line is a blank line. That is to say, you need to enter a carriage return after test before you can save the disk and exit !!!If there is no space after the colon, the JAR file can be generated but cannot be executed. If there is no carriage return character after test, an error will be reported when the JAR file is generated.
4. Pack test.classinto A. jarfile and use abc.txt to specify w
Original link:Http://blog.chinaunix.net/uid-692788-id-2681136.htmlA jar package is a compressed document that is unique to Java, and you can actually interpret it as a. zip package.Of course there is a difference, there is a meta-inf\manifest in the jar package. MF file, which is generated automatically when you find a jar package.The
I. Preface
In commercial development, development classes are often packaged into jar packages for release. many third-party jar packages provide function sets, so these function packages are often used. the following scenarios are frequently encountered by many Java developers: in the Development and debugging phase, the self-compiled class works normally by setting the third-party
(1) operate in eclipse
The above version of eclipse is:
(2) The following describes the relevant principles and the operation details for manually completing this goal:
We all know that a Java application project can be packaged into a jar. Of course, you must specify a main class with the main function as the program entry for your jar package.
The specific method is to modify the manifest. MF file under
Reprinted from: http://www.cnblogs.com/lanxuezaipiao/p/3291641.htmlScenario One: The export feature that comes with eclipseStep 1: Prepare the master manifest file "MANIFEST." MF ",Because it is a Java project that refers to a third-party jar package, a custom configuration file, MANIFEST.MF, is required to create the file MANIFEST.MF under the project, which reads as follows:Manifest-version:1.0class-path:lib/commons-codec.jar Lib/commons-httpclient-
Actual problem encountered: a server and Client communication program (dependent on a third-party jar pack) Console execution server or client total error java.lang.NoClassDefFoundError, and the class is not defined by itself, tangled up found is a packaging error, did not find a third-party jar package, the solution is as follows:
Scenario 0: With the eclipse with the export function, exported runnabl
Under Linux Execute Jar file method: Enter file directory under command line,execute Java-jar file.jar i.e.Can also create a launcher on the desktop, fill in the command bar related commands: Java-jar/file path/file.jar, so that the desktop double-click to open the Jar fileCreate an executable
We oftenCodeRead some resource files (such as video, music, text, etc ). These simple operations are certainly not problematic when running them separately. However, if we compress the code into a jar package, even if we package the resource files together, these things cannot be found. Take a look at the following code: Java code
//Source code1:
PackageEdu. hxraid;
ImportJava. Io .*;
PublicClassResource {
PublicVoidGetresource ()ThrowsI
In maven, by default, the dependent JAR package is not scored into the executable jar package, and if you need to break the dependency into the executable jar package, you need topomadded inmaven-assembly-pluginplug-ins, this is easy to implement, but it is not recommended in the formal development of such use, why? Because a slightly larger project has at least
Sometimes you need to export the j2se project so that it can operate elsewhere, so you don't have to stick to the feeling of development before it can run.The procedure is as follows:Method 1: (export directly when the project does not reference an external jar package)
Select project ----> right-click, Export... ---> Java ---> JAR file ---> next --> select the path and name of
Jar package merge and jar merge
Merge multiple jar packages:
1. First, extract the jar package to be merged to the same directory. Jar xvf xxx. jar
2. Use the jar command to package
Reprint: Http://hxraid.iteye.com/blog/483115?page=3#commentsWe often read some resource files in the code (compared to slices, music, text, etc.). These simple processes are of course not problematic when running alone. However, if we make the code into a jar package, even if the resource files are packaged together, these things will not be found. Take a look at the following code://Source code 1: PackageEdu.hxraid;ImportJava.io.*; Public classResour
During the project process, use eclipse to compress a jar package and use export --> JAVA --> JAR file. In my jar package, a third-party jar package, such as log4j, I also encountered this problem:
Http://zhidao.baidu.com/question/48376665.html
"Other jar packages are refe
1. Preparatory work:For the sake of convenience, here is an example of Project Class2json in Eclipse, the project structure is as follows:Bin: is based on the execution. Java-generated. class file, the directory under the bin is the same as the SRC directory, except for the. class file Lib: External dependency package src: We wrote it ourselves. java filesNext:1 . We create a new Class2json_jar folder 2 . Copy the files under the bin to Class2json_jar 3 . And the whole LIB to copy the past, the
First, make Jar fileBefore you can create a. jar file, you must first compile your. java file. Let's say our file directory is C:javamyjavahellohello.java.Now suppose Hello.java's file content is:/*** Hello.java**/public class Hello {public static void Mian (string[] args) {System.out.println ("Hello, World!");}}During the. jar authoring you must switch the path
The jar command successfully completed the Java-jar command but prompted "No master manifest attribute"! Http://www.bieryun.com/1181.htmlThe jar command successfully completed the Java-jar command but prompted "No master manifest attribute"! I do not understand, I do not know how long before I used the
Java basics-knowledge about jar packages, Java jar packages
Before learning the jar package, you must first understand the Java package and related concepts about the Java package.
I. Package
Java provides a package mechanism to better organize classes. A package is a class container used to separate class namespace. If no package name is specified, all examples
Package and use the JAR library in JAR
I wonder if you have such a requirement when writing a Java program: Package the project that references other third-party JAR libraries into a JAR file for running. that is to say, the packaged JAR file contains the third-party
Java Project export as jar package + export third-party jar + use command-line Invoke + Pass-through, packageScenario 1: You do not need to pass parameters to the program, and the program does not use third-party jar packagesExport jar on eclipse:Then select a Java file to be used as the storage, with main () Main func
Open the command prompt (Win2000 or run the CMD command in the running box, Win98 is the DOS prompt), enter jar chelp, and press enter (if jdk1.1 or a later version already exists on your disk ), what do you see:
Usage: jar {ctxu} [vfm0mi] [Jar-file] [manifest-file] [-C Directory] File Name...
Option:
-C. Create a new archive
-T list the archived content
-X expan
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.