the understanding of classpath and the way of its use
Original address:http://blog.csdn.net/wk1134314305/article/details/77940147?from=bdhd_site
A machine with a JDK or JRE installed can view the available commands (. exe. dll) under these two directories:
C:\Program Files\ibm\sqllib\java\jdk\bin
C:\Program Files\ibm\sqllib\java\jdk\jre\bin
Summary:
Classpath is the path of the Java Runtime environment to search for classes and other resource files (such as resources such as Jar\zip).
There are two main ways to set Classpath:
(1) Set the command line of the JDK for each application
This setting is set primarily for each application, and does not affect the classpath of other programs and the classpath of the environment variables, which only take effect in the current window. ( recommended)
C:> sdktool-classpath classpath1, classpath2 ...
(2) Set the CLASSPATH environment variable, this is the global setting, for all applications to take effect
C:> set classpath=classpath1; Classpath2 ...
classpath Description of the Javaweb project
Original address:https://www.cnblogs.com/jycboy/p/7349139.html?from=bdhd_site
Summary:
classpath refers to the classes directory under the Web-inf folder
Explain the meaning of classes:
- Store various resource profiles eg.init.properties log4j.properties Struts.xml
- Storing template files Eg.actionerror.ftl
- The storage class file corresponds to the SRC directory compilation file when the project was developed.
Summary: This is an entry point for locating resources
To refer to a file under the Classpath path, simply add classpath before the file name: (Ensure that the file is indeed located under the Classpath path)
(1) ApplicationContext ctx = new
classpathxmlapplicationcontext("Xxxx.xml"); Read the Spring.xml configuration file under
ClassPath (2) ApplicationContext ctx = new
filesystemxmlapplicationcontext(" Webroot/web-inf/xxxx.xml "); Read the Spring.xml file under
web-inf
the BuildPath in eclipse (Must see article)
Original address:https://m.jb51.net/article/115544.htm?from=bdhd_site
Summary:
What is build Path?
The Build path is a collection of resource properties that specifies the Java project contains.
In a mature Java project, not only the source code, but also the System Runtime Library (JRE), the third-party function extension Library, other works in the workspace, and even the external class files, all of these resources are dependent on this project, and only to be referenced before the project can be compilation succeeds, and build path is used to configure and manage references to these resources.
The Build path typically includes:
- JRE Runtime Library
- Third-party feature Extensions library (*.jar format files)
- Other projects
- Other source or class files
Specific content in Eclipse is described in:
To open the Build Path management interface: Right-click on the project->build path->configure build Path
Projects options: You can add, edit, and remove items that the current project depends on.
Libraries Options: You can add, edit, and remove library files that the current project depends on. ← Note that Lib library files will not automatically be included after the project is packaged, only at compile time, if you need to package together, you need to copy to SRC
Add JARs: is the jar file that is added in the current project directory.
Add External JARs: is a jar file in an external directory that is added outside the current project. such as JDBC
Add Variable: is a variable added.
Add Library : is the repository for adding JRE systems.
Add class Folder: adds the. class file that is compiled in the current project.
Add External class Folder: adds A. class file other than the current project.
Order and export: You can sort the libraries that are already added to the current project, or you can set whether the library files also follow the project export when the current project is exported.
the build path of the Java project in eclipse is detailed
Original address:https://www.cnblogs.com/ermu-learn/archive/2016/01/21/5147354.html?from=bdhd_site
Summary:
The following highlights the user Libraries in the Add library
Add the user Library as follows:
1. Select Project Right-click->build path->add Libraries ...
2. Select User Library->next
3. Click the User Library button
4. Click the New button
5. Enter the library name (I'm going to import the Struts 2.1.6 jar package and the JDBC jar package, so you can use the Struts 2.1.6 library for ease of memory)
6. Click OK
7. Select the user library and click Add Jars
8. Locate the corresponding jar package, and then click OK.
The User liberary is added to eclipse, only in Eclipse, where Eclipse knows where to put the referenced classes, but if you want the Web project to start properly,
is to tell Tomcat and other containers where your jar package is (in the Lib directory, the container will know). So that's what happens when you add the user library to eclipse, just to tune
Try, do not join the user library, eclipse can not find the import class, there will be a red X, do not put the jar package in the user library under the LIB, the capacity can not find the class introduced, will be error.
The difference between the Add jar and the add external jars and the user libraries in the Add library is:
The jar packages added through the "Add Jar" and "Add external jars" are packaged as part of the program into the final program. The jar package that was added via "User Libraries" is not.
Talk about the understanding of classpath/eclipse build Path