「Spring认证」Spring环境设置

讨论 0 434
IT胶囊
IT胶囊 LV1 2021年4月22日 19:59 发表
点击群号免费加入社区交流群:367346704
<p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">本章将指导您如何准备开发环境以开始使用 Spring Framework。它还将教您如何在设置 Spring Framework 之前在您的机器上设置 JDK、Tomcat 和 Eclipse -</p><h2 id="%E6%AD%A5%E9%AA%A4-1---%E8%AE%BE%E7%BD%AE-Java-%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7%E5%8C%85-(JDK)" name="%E6%AD%A5%E9%AA%A4-1---%E8%AE%BE%E7%BD%AE-Java-%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7%E5%8C%85-(JDK)" style="margin-top: 16px; margin-bottom: 8px; font-size: 16px; list-style: inherit; font-weight: bold; line-height: 26px; font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">步骤 1 - 设置 Java 开发工具包 (JDK)</h2><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">您可以从 Oracle 的 Java 站点 - Java SE 下载下载最新版本的 SDK <a href="https://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank" rel="nofollow noopener noreferrer" style="list-style: inherit; color: rgb(0, 164, 255);">。</a>您将在下载的文件中找到安装 JDK 的说明,按照给定的说明安装和配置设置。最后设置 PATH 和 JAVA_HOME 环境变量以引用包含 java 和 javac 的目录,通常分别为 java_install_dir/bin 和 java_install_dir。</p><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">如果您运行的是 Windows 并且已在 C:\jdk1.6.0_15 中安装了 JDK,则必须将以下行放入 C:\autoexec.bat 文件中。</p><pre style="list-style: inherit; margin-top: 0.5em; margin-bottom: 0.5em; padding: 1em; color: rgb(204, 204, 204); background: rgb(80, 85, 107); border-radius: 3px; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; overflow-wrap: normal; white-space: pre; word-break: normal; tab-size: 4; hyphens: none; font-size: 14px;"><span style="list-style: inherit; color: rgb(204, 153, 205);">set</span> PATH<span style="list-style: inherit; color: rgb(103, 205, 204);">=</span>C<span style="list-style: inherit;">:</span>\jdk1<span style="list-style: inherit; color: rgb(240, 141, 73);">.6</span><span style="list-style: inherit;">.</span>0_15\bin<span style="list-style: inherit;">;</span><span style="list-style: inherit; color: rgb(103, 205, 204);">%</span>PATH<span style="list-style: inherit; color: rgb(103, 205, 204);">%</span> <span style="list-style: inherit; color: rgb(204, 153, 205);">set</span> JAVA_HOME<span style="list-style: inherit; color: rgb(103, 205, 204);">=</span>C<span style="list-style: inherit;">:</span>\jdk1<span style="list-style: inherit; color: rgb(240, 141, 73);">.6</span><span style="list-style: inherit;">.</span>0_15 </pre><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">或者,在 Windows NT/2000/XP 上,您必须右键单击“我的电脑”,选择“属性”→“高级”→“环境变量”。然后,您必须更新 PATH 值并单击“确定”按钮。</p><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">在 Unix(Solaris、Linux 等)上,如果 SDK 安装在 /usr/local/jdk1.6.0_15 并且您使用 C shell,则必须将以下内容放入 .cshrc 文件中。</p><pre style="list-style: inherit; margin-top: 0.5em; margin-bottom: 0.5em; padding: 1em; color: rgb(204, 204, 204); background: rgb(80, 85, 107); border-radius: 3px; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; overflow-wrap: normal; white-space: pre; word-break: normal; tab-size: 4; hyphens: none; font-size: 14px;">setenv PATH <span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>usr<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>local<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>jdk1<span style="list-style: inherit; color: rgb(240, 141, 73);">.6</span><span style="list-style: inherit;">.</span>0_15<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>bin<span style="list-style: inherit;">:</span>$PATH setenv JAVA_HOME <span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>usr<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>local<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>jdk1<span style="list-style: inherit; color: rgb(240, 141, 73);">.6</span><span style="list-style: inherit;">.</span>0_15 </pre><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">或者,如果您使用集成开发环境 (IDE),如 Borland JBuilder、Eclipse、IntelliJ IDEA 或 Sun ONE Studio,则必须编译并运行一个简单的程序以确认 IDE 知道您安装 Java 的位置。否则,您必须按照 IDE 文档中的说明进行适当的设置。</p><h2 id="%E7%AC%AC-2-%E6%AD%A5---%E5%AE%89%E8%A3%85-Apache-Common-Logging-API" name="%E7%AC%AC-2-%E6%AD%A5---%E5%AE%89%E8%A3%85-Apache-Common-Logging-API" style="margin-top: 16px; margin-bottom: 8px; font-size: 16px; list-style: inherit; font-weight: bold; line-height: 26px; font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">第 2 步 - 安装 Apache Common Logging API</h2><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">您可以从下载最新版本的 Apache Commons Logging API 。下载安装后,将二进制分发包解压到一个方便的位置。例如,Windows 上的 C:\commons-logging-1.1.1 或 Linux/Unix 上的 /usr/local/commons-logging-1.1.1。该目录下会有以下jar文件和其他支持文件等。</p><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;"></p><figure style="list-style: inherit; margin-top: 16px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;"><div style="list-style: inherit;"><span style="list-style: inherit;"><img src="https://ask8088-private-1251520898.cn-south.myqcloud.com/developer-images/article/6461686/8c2ne4jy0d.jpg?q-sign-algorithm=sha1&amp;q-ak=AKID2uZ1FGBdx1pNgjE3KK4YliPpzyjLZvug&amp;q-sign-time=1629090529;1629097729&amp;q-key-time=1629090529;1629097729&amp;q-header-list=&amp;q-url-param-list=&amp;q-signature=a9cbeaa59c7c6d0aba6a8018fdc68c218fe0199e" style="border-width: 0px; border-style: initial; list-style: inherit; display: block; margin-right: auto; margin-left: auto; max-width: 100%; max-height: 100%; box-shadow: rgba(3, 27, 78, 0.12) 0px 4px 8px; border-radius: 3px; cursor: zoom-in;"></span></div></figure><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">确保在此目录中正确设置了 CLASSPATH 变量,否则在运行应用程序时会遇到问题。</p><h2 id="%E7%AC%AC-3-%E6%AD%A5---%E8%AE%BE%E7%BD%AE-Eclipse-IDE" name="%E7%AC%AC-3-%E6%AD%A5---%E8%AE%BE%E7%BD%AE-Eclipse-IDE" style="margin-top: 16px; margin-bottom: 8px; font-size: 16px; list-style: inherit; font-weight: bold; line-height: 26px; font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">第 3 步 - 设置 Eclipse IDE</h2><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">本教程中的所有示例都是使用 Eclipse IDE 编写的。所以我们建议您应该在您的机器上安装最新版本的 Eclipse。</p><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">要安装 Eclipse IDE,请从下载最新的 Eclipse 二进制文件。下载安装后,将二进制分发包解压到一个方便的位置。例如,在 Windows 上的 C:\eclipse 或 Linux/Unix 上的 /usr/local/eclipse 中,最后适当地设置 PATH 变量。</p><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">Eclipse 可以通过在 Windows 机器上执行以下命令来启动,也可以直接双击 eclipse.exe</p><pre style="list-style: inherit; margin-top: 0.5em; margin-bottom: 0.5em; padding: 1em; color: rgb(204, 204, 204); background: rgb(80, 85, 107); border-radius: 3px; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; overflow-wrap: normal; white-space: pre; word-break: normal; tab-size: 4; hyphens: none; font-size: 14px;"><span style="list-style: inherit; color: rgb(103, 205, 204);">%</span>C<span style="list-style: inherit;">:</span>\eclipse\eclipse<span style="list-style: inherit;">.</span>exe </pre><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">Eclipse 可以通过在 Unix(Solaris、Linux 等)机器上执行以下命令来启动 -</p><pre style="list-style: inherit; margin-top: 0.5em; margin-bottom: 0.5em; padding: 1em; color: rgb(204, 204, 204); background: rgb(80, 85, 107); border-radius: 3px; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; overflow-wrap: normal; white-space: pre; word-break: normal; tab-size: 4; hyphens: none; font-size: 14px;">$<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>usr<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>local<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>eclipse<span style="list-style: inherit; color: rgb(103, 205, 204);">/</span>eclipse</pre><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">成功启动后,如果一切正常,则应显示以下结果 -</p><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;"></p><figure style="list-style: inherit; margin-top: 16px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;"><div style="list-style: inherit;"><span style="list-style: inherit;"><img src="https://ask8088-private-1251520898.cn-south.myqcloud.com/developer-images/article/6461686/uhq6ojcw5c.jpg?q-sign-algorithm=sha1&amp;q-ak=AKID2uZ1FGBdx1pNgjE3KK4YliPpzyjLZvug&amp;q-sign-time=1629090529;1629097729&amp;q-key-time=1629090529;1629097729&amp;q-header-list=&amp;q-url-param-list=&amp;q-signature=dd1a82e7cc0d7fcffe771517d65a958c45fa07ef" style="border-width: 0px; border-style: initial; list-style: inherit; display: block; margin-right: auto; margin-left: auto; max-width: 100%; max-height: 100%; box-shadow: rgba(3, 27, 78, 0.12) 0px 4px 8px; border-radius: 3px; cursor: zoom-in;"></span></div></figure><h2 id="%E7%AC%AC-4-%E6%AD%A5---%E8%AE%BE%E7%BD%AE-Spring-%E6%A1%86%E6%9E%B6%E5%BA%93" name="%E7%AC%AC-4-%E6%AD%A5---%E8%AE%BE%E7%BD%AE-Spring-%E6%A1%86%E6%9E%B6%E5%BA%93" style="margin-top: 16px; margin-bottom: 8px; font-size: 16px; list-style: inherit; font-weight: bold; line-height: 26px; font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">第 4 步 - 设置 Spring 框架库</h2><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">现在如果一切正常,那么您可以继续设置您的 Spring 框架。以下是在您的机器上下载和安装框架的简单步骤。</p><ul style="margin-top: 0px; margin-bottom: 16px; margin-left: 0px; list-style: none; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;"><li style="margin-bottom: 4px; padding-left: 18px; list-style-type: none; position: relative;">选择是否要在 Windows 或 Unix 上安装 Spring,然后继续下一步下载 Windows 的 .zip 文件和 Unix 的 .tz 文件。</li><li style="margin-bottom: 4px; padding-left: 18px; list-style-type: none; position: relative;">从下载最新版本的 Spring 框架二进制文件。</li><li style="margin-bottom: 4px; padding-left: 18px; list-style-type: none; position: relative;">在开发本教程时,在 Windows 机器上下载了<strong style="list-style: inherit;">spring-framework-4.1.6.RELEASE-dist.zip</strong>。下载的文件解压后,E:\spring 目录结构如下。</li></ul><figure style="list-style: inherit; margin-top: 16px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;"><div style="text-align: center; list-style: inherit;"><span style="list-style: inherit;"><img src="https://inews.gtimg.com/newsapp_bt/0/13887338919/641" style="max-width:100%;"><br></span></div></figure><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">您将在<strong style="list-style: inherit;">E:\spring\libs</strong>目录中找到所有 Spring 库。确保在此目录中正确设置了 CLASSPATH 变量,否则在运行应用程序时会遇到问题。如果您使用的是 Eclipse,则不需要设置 CLASSPATH,因为所有设置都将通过 Eclipse 完成。</p><p style="margin-top: 0px; margin-bottom: 8px; list-style: inherit; min-height: 24px; color: rgb(51, 51, 51); font-family: &quot;pingfang SC&quot;, &quot;helvetica neue&quot;, arial, &quot;hiragino sans gb&quot;, &quot;microsoft yahei ui&quot;, &quot;microsoft yahei&quot;, simsun, sans-serif; white-space: pre-wrap;">完成最后一步后,您就可以继续下一章中的第一个 Spring 示例了。</p>
收藏(0)  分享
相关标签: spring
0个回复
  • 消灭零回复