Summary
This article shows you how to make a jar that is not available to run and not manipulate the manifest file directly. You will learn to develop a short program so that any jar file can be run using the Java-jar command or by double-clicking on Windows like.
You can package all the classes and resources of an application into a
follows:
(1) Place the database Driver (jar package) in the lib folder under the Tomcat installation directory.
(2) manually create a context. xml file under the WebContent \ META-INF \ directory of the project, edit the content, the final content is as follows:
DriverClassName = "com. microsoft. sqlserver. jdbc. SQLServerDriver"
Url = "jdbc: sqlserver: // localhost: 1433; DatabaseName = test"/>
(3) then manually create a web. xml file under the
, Dom4j.jar is a Java XML API, similar to Jdom, used to read and write XML files. Hibernate uses it to read and write configuration files. NecessaryThe above is Hibernate's core jar package, is necessary to configure the SSH architecture, the following are optional.=========================================================Versioncheck.jar version Check OptionalSwarmcache.jar OptionalJboss-cache.jar Treecache OptionalJgroups.jar OptionalXalan.jar, Xerce
The reason to export the runnable JAR. is because we want to export the referenced jar package with this project, so do not select the Jar fileChoose File/export ... Then java/runnable the jar file and select the class with main () to run, choose extract required libraries into generated
I used eclipse packaging, but reported that there was no master list attribute error in the Activemq.jar when the cmd window was executed.
Search on the Internet, this is related to the MANIFEST.MF file, the file does not define the main method in the class path, the use of good pressure to open the jar package, and sure enough. There's only one line inside.
manifest-version:1.0
You need to add Main-class. In this example, add the following:
Main-
Java packaged into Jars
JAR-CVF [Name of jar package] [file to be packaged]
Execute the Main method in the JAR package
Java-jar ****.jar
Always runs the specified main method after execution, and if there are multiple main methods in the
We 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 classResource { Public voidGetResource ()throwsioexception{File File=N
the mechanism of thread operation
1. Too many threads will consume CPU
2. Single-core CPUs, only one thread at a time, multi-core CPUs can handle multiple threads at the same time
3. The operating system for each running thread to schedule a certain amount of CPU time----' time slice ', the system through a circular way for the thread to provide a time slice, the thread in its own time to run, because the time is quite short, multiple threads frequently switch, so the user feels
Implementation Scenario One:
1 the task in the frequency H1 (30 seconds) timing, the frequency of the task to perform the time required to exceed the frequency of the time period (30 seconds), the frequency of the task has not been completed, the next execution of the task Midway interrupted;
2 The second 30 second time node (that is, the next frequency) when scheduling tasks, because there is no idle thread (the previous frequency task takes up all the threads), there is a large number of threa
The Java-jar command is used to run a jar package recently, but the java. Lang. noclassdeffounderror exception is always thrown, but the relevant jar package has been put in the classpath, which cannot be understood. The command format is as follows:
@ Echo offSet project_home
=
E:/wingfeng/website/doimfSet java_home
=
D:/Java/jdk1
. 5
. 0 _
11
@
The first time I saw a. jar file I didn't know what the ghost was, thought it was a compressed package, and it was unpacked, but it didn't work. So here's a detailed description of how to open the. jar file and how to run the. jar file. What is a. jar file, simply a Java compact package, can be opened with a Java virtu
Export the project as a jar package divided into runnable jar and normal jar packageFirst, export to ordinary jar packageThe jar package only has the project source code, JAVA-CP Wordcount.jar is used to run the ordinary jar packa
Ext.: https://www.cnblogs.com/Think-007/p/7852589.htmlPersonal development, there is no need to build a nexus, so for us to use Spring boot development project, we will introduce the local jar package, for example, I will build a Lib package in the root directory, and then put the local jar inside, add to the Classpath reference.Then you will find that when we hit the j
Import the android package into the jar package, package the jar package into the library. KanKanStyle, androidkankankanstyle(1) Import JAR packages to a project: 1. Copy the external jar packages to a libs directory in the project EC or MYec. The old project does not have the lib directory. If it is called lib, an err
DBCP Connection Pool configuration
About DBCP Connection pool The specific use of the method also need to refer to: Click to open the link dbcp jar package
Commons-dbpc.jar, Commons-collections.jar, commons-pool.jar download click to downloadc3p0 Connection Pool configuration
For more information on C3P0 connec
OverviewIn the previous chapter, "Java Multithreading Series--" Juc thread pool "02 Thread pool principle (a)" describes the data structure of the thread pool, this chapter will be analyzed through the source code of the threads pools, to explain the threading pooling. The content includes:Line Pooling ExampleReference code (based on JDK1.7.0_40)Line Cheng Code A
Senior brother has deployed a new virtual machine. This is a new term! Previously due to CrawlersCodeIt is unstable, so it is always run directly with eclipse, and then modified when problems occur. But this is troublesome, and eclipse occupies a lot of memory! So this afternoon, I removed the previous code, which is frustrating for many systems. out. println replaces log4j. The path, database connection, and configuration file are used for processing. Finally, it is compiled into an executable
Like-CP and-classpath, it is the path to the other classes that the specified class runs on, usually the class library, the jar package, and the full path to the jar package, the semicolon ";" JAVA-CP on the window. Myclass.jar Packname.mainclassnameThe jar file in the classpath can use wildcards, and if it is multiple jar
From: http://blog.sina.com.cn/s/blog_4fcc6ef20100vzo3.html
It took me a few hours to get JDK today. After installation, I found that there are no tools. jar and DT. Jar packages in JDK \ Lib. I found many solutions on the Internet, but they did not solve the problem. Finally, we can see an essential solution. The cause of this problem is that JDK and JRE are placed in the same directory during JDK installa
Thread Pool learning and thread pool
Creating a New thread and starting it will incur a high overhead, because the running thread requires more resources than calling the object method. In many cases, threads are used to execute a type of task, which has a large number of tasks and the time distribution is uneven. If a new thread is enabled for each new task, the overhead is too large. A performance optimiz
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.