本篇内容介绍了“Ubuntu下安装JDK和Tomcat的方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
操作系统:Ubuntu Server 7.1
Ubuntu下安装JDK
1.查询可以使用的JDK。
root@ubuntu-163jsp:/# apt-cache search jdk libpg-java - Java database (JDBC) driver for PostgreSQL free-java-sdk - Complete Java SDK environment consisting of free Java tools icedtea-java7-bin - Java runtime based on OpenJDK icedtea-java7-demo - Java runtime based on OpenJDK icedtea-java7-doc - Icedtea Development Kit (JDK) documentation icedtea-java7-jdk - Java runtime based on OpenJDK icedtea-java7-jre - Java runtime based on OpenJDK icedtea-java7-plugin - Java plugin based on OpenJDK and gcjwebplugin icedtea-java7-source - Icedtea Development Kit (JDK) source files japitools - Java API compatibility testing tools kaffe - A JVM to run Java bytecode libcommons-lang-java - Extension of the java.lang package libcommons-launcher-java - cross platform java application launcher libicu4j-java - Library for unicode support and internalisation libitext-java - Java Library to generate PDF on the Fly librxtx-java - Full Java CommAPI implementation mmake - Makefile generator for Java programs usepackage - utility to manage environment variables from within dotfiles jde - JDEE, Java Development Environment for Emacs(en) sun-java5-bin - Sun Java(TM) Runtime Environment (JRE) 5.0 (architecture dependent files) sun-java5-demo - Sun Java(TM) Development Kit (JDK) 5.0 demos and examples sun-java5-doc - Sun JDK(TM) Documention -- integration installer sun-java5-jdk - Sun Java(TM) Development Kit (JDK) 5.0 sun-java5-jre - Sun Java(TM) Runtime Environment (JRE) 5.0 (architecture independent files) sun-java5-source - Sun Java(TM) Development Kit (JDK) 5.0 source files sun-java6-bin - Sun Java(TM) Runtime Environment (JRE) 6 (architecture dependent files) sun-java6-demo - Sun Java(TM) Development Kit (JDK) 6 demos and examples sun-java6-doc - Sun JDK(TM) Documention -- integration installer sun-java6-javadb - Java(TM) DB, Sun Microsystems' distribution of Apache Derby sun-java6-jdk - Sun Java(TM) Development Kit (JDK) 6 sun-java6-jre - Sun Java(TM) Runtime Environment (JRE) 6 (architecture independent files) sun-java6-source - Sun Java(TM) Development Kit (JDK) 6 source files libc6-i686 - GNU C Library: Shared libraries [i686 optimized]
2.选择安装 sun-java6-jdk
apt-get install sun-java6-jdk
3.文件都装那里去了呢?
搜寻了一下发现文件安装在 :/usr/lib/jvm/java-6-sun-1.6.0.03 下了。
/usr/lib/jvm/java-6-sun 是/usr/lib/jvm/java-6-sun-1.6.0.03 的符号链接。
4.设置JAVA_HOME变量
编辑/etc/profile文件,添加如下内容:
JAVA_HOME=/usr/lib/jvm/java-6-sun export JAVA_HOME
注意,保存后重新登录,这个环境变量就生效了。
Ubuntu下安装JDK完毕,安装Tomcat
1.查询可用的Tomcat
root@ubuntu-163jsp:/# apt-cache search tomcat libservlet2.3-java - Servlet 2.3 and JSP 1.2 Java classes and documentation libservlet2.4-java - Servlet 2.4 and JSP 2.0 Java library. libservlet2.4-java-doc - Servlet 2.4 and JSP 2.0 Java documentation libservlet2.4-java-gcj - Servlet 2.4 and JSP 2.0 Java classes and documentation jspwiki - WikiWikiWeb clone written in Java libapache-mod-jk-doc - Documentation of libapache-mod-jk/libapache2-mod-jk packages libapache2-mod-jk - Apache 2 connector for the Tomcat Java servlet engine libtomcat5.5-java - Java Servlet engine -- core libraries tomcat5.5 - Servlet and JSP engine tomcat5.5-admin - Java Servlet engine -- admin & manager web interfaces tomcat5.5-webapps - Java Servlet engine -- documentation and example web applications webxml - Simple form-based generator/editor of Tomcat's web.xml files
2.安装tomcat5.5
apt-get install tomcat5.5
如果你要和apache2整合,可以把mod_jk安装上。
apt-get install libapache2-mod-jk
3.运行tomcat
tomcat的安装文件在 /usr/share/tomcat5.5里。
运行 /usr/share/tomcat5.5/bin/startup.sh,tomcat就启动了。
这个端口竟然是8180,停止也出现错误还是自己下载安装吧。
提示:其实jdk和tomcat,都可以不用ubuntu提供的包,sun的网站有linux的jdk,apache也有tomcat,直接解压tomcat就可以用了,JAVA_HOME变量别忘了。
这样就完成了Ubuntu下安装JDK和Tomcat。
“Ubuntu下安装JDK和Tomcat的方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。