What is the difference between Class Path and Build Path
2016-02-20 10:55
621 查看
转自:http://stackoverflow.com/questions/3529459/what-is-the-difference-between-class-path-and-build-path
问:
I'm confused with these two terms.
Also what should I do to create a file under the src folder of a Spring MVC Project? When I create using a File object it creates the file inside C:\SpringSourceTool... I guess this is ClassPath right?
How can I get the
or root of the application whatever?
答:
1.The build path is used for building your application. It contains all of
your source files and all Java libraries that are required to
compile the application.
The classpath is used
for executing the application. This includes all java classes and libraries that are needed to
run the java application. A Classpath is mandatory, the default path is
is used if the java virtual machine can't find a user defined path. (
variable,
or
in a jar manifest)
2.The classpath is the conventional way to tell the Java compiler and the Java runtime where to find compiled classes.
It is typically a sequence of JAR file names and directory names. The classpath used by the compiler and the runtime system don't have to be the
same, but they typically "should be*, especially for a small project.
Buildpath is not standard Java terminology. It is the term for the richer way that a typical IDE specifies the relationship between the "modules" or "projects" that make up an application. The IDE uses this to figure out the classpath and sourcepath for compiling
the Java code, and the classpath for running it. The IDE also uses the build path to figure out how to package up your code and its dependencies as (for example) a WAR file.
For example, an Eclipse build path for a project includes the other projects that it depends on, and lists any additional library JARs that the project contains / relies on. It also lists the packages in the current project that downstream projects can depend
on.
(If you are using Maven for your project, the IDE buildpath mechanism is secondary to the dependencies declared in the POM files. For example, using Eclipse with the m2eclipse, the buildpath is synthesized from the POM files.)
问:
I'm confused with these two terms.
Also what should I do to create a file under the src folder of a Spring MVC Project? When I create using a File object it creates the file inside C:\SpringSourceTool... I guess this is ClassPath right?
How can I get the
applicationcontextfolder
or root of the application whatever?
答:
1.The build path is used for building your application. It contains all of
your source files and all Java libraries that are required to
compile the application.
The classpath is used
for executing the application. This includes all java classes and libraries that are needed to
run the java application. A Classpath is mandatory, the default path is
.which
is used if the java virtual machine can't find a user defined path. (
CLASSPATHenvironment
variable,
-cpflag
or
Class-Path:attribute
in a jar manifest)
2.The classpath is the conventional way to tell the Java compiler and the Java runtime where to find compiled classes.
It is typically a sequence of JAR file names and directory names. The classpath used by the compiler and the runtime system don't have to be the
same, but they typically "should be*, especially for a small project.
Buildpath is not standard Java terminology. It is the term for the richer way that a typical IDE specifies the relationship between the "modules" or "projects" that make up an application. The IDE uses this to figure out the classpath and sourcepath for compiling
the Java code, and the classpath for running it. The IDE also uses the build path to figure out how to package up your code and its dependencies as (for example) a WAR file.
For example, an Eclipse build path for a project includes the other projects that it depends on, and lists any additional library JARs that the project contains / relies on. It also lists the packages in the current project that downstream projects can depend
on.
(If you are using Maven for your project, the IDE buildpath mechanism is secondary to the dependencies declared in the POM files. For example, using Eclipse with the m2eclipse, the buildpath is synthesized from the POM files.)
相关文章推荐
- easyui 分页实现
- Windows 10 Quick Tip: How To Disable Recycle Bin
- 布尔操作的“骤死式”(short-circuiting behavior)
- 1017. Queueing at Bank (25)
- UITextView输入属性文字
- [置顶].NET平台开源项目速览(6)FluentValidation验证组件介绍与入门(一)
- .NET平台开源项目速览(10)FluentValidation验证组件深入使用(二)
- string和stringbuffer stringbuilder的快速理解。
- 【POJ】[2031]Building a Space Station
- 使用 dbms_xplan.display 按照 plan_hash_value 查执行计划的方法
- Entity Framework Fluent API
- JSP中四种属性范围(pageContext,request)
- 非UI线程在休眠与不休眠情况下更新UI的原理分析
- 简单的UIPickView功能
- poj 1019 Number Sequence 找规律 思维题 ()
- Android Wear 进阶 - 3 Creating Custom UIs for Wear Devices 创建自定义的手表设备UIs
- Light OJ 1421 Wavio Sequence (简单DP)
- Hdu 2604 Queuing【矩阵快速幂】
- 【POJ】2031 - Building a Space Station(克鲁斯塔尔)
- [Introduction to programming in Java 笔记] 1.3.8 Gambler's ruin simulation 赌徒破产模拟