Java In Linux
i feel kinda stupid for this cause i figured it would be easy, but im stuck. it all started when trying to run some jsp pages off a rh9 server that uses apache. the jsp pages loaded and displayed the static content, but did not execute the simple java code i had. no biggy i figured, i just need to put java on there. so i downloaded and installed a JRE rpm, but that didnt do anything. i dont know how to activate it. im using a website that i know of that requires java to work. so as a test i go to this site and it keeps telling me that my java isnt activated, and my jsp still isnt working, so what do i need to do to get java to work right?
|
If this isn't the most asked question on this site, I don't know what is.
You need to make a link between your browswers plugin directory and the appropriate java plugin. You probably also need to put the java/bin directory in your path and maybe even set your JAVA_HOME environement variable. Use the search button and you will find literally hundreds of posts explaining everything in great detail |
what browser and browser version are you using? asking the version, since choosing the correct java plugin depends on which version of mozilla you're using, if you're using mozilla. but the gist of it is to create a symbolic link inside your browser's plugins directory to the java plugin provided in the jre.
in mozilla 1.4 and higher, you'll need to link to the plugin in the ns610-gcc32 directory in your java install. for mozilla versions less than 1.4, link to the plugin in the ns610 directory in your java install. opera, should be able to automatically know that java is installed. if not, there's an option to tell opera a java install directory. usually the path is: /usr/java/j2sdk1.4.2_02/jre/lib/i386/ you'll have to change the bold to the version of java you're using (the version is used as a directory when java is installed). also the above may be different as i'm using the sdk but it shouldn't be much different. you'll probably also want to set the path to java. some programs look for the JAVA_HOME variable. i like to use pathmunge in the /etc/profile. it'll look something like this: Quote:
anyhoo, hope this helps you. |
Your question is quite confusing. I will attempt to address the two issues I found.
JSP Java Server Pages are a server side technology, which allows you to incorporate Java code, tags, EL, into standard HTML pages. JSP's are interpreted by a servlet container and compiled into Java classes which return HTML to clients accessing them via the servlet container. If you wish to write JSP pages an learn some Java you will need a container such as tomcat. http://jakarta.apache.org/tomcat/index.html Apache is a regular http webserver that is not able to process jsp pages. (Note there are some apache modules that allow for this) Java Applets If you are looking to view web pages that require the Java plug-in take the advise of the above post! Note applets are not jsp .. jsp is server site and require a servlet container, applets are run on the client and require the Java plug-in. -Matt |
ok my confusion was with tomcat then. didnt know i needed it. im still stuck in the windows state of mind, where IIS can run ASP without additional plugins. Tomcat doesnt look too easy to configure, but i guess thats the charm of linux
|
Tomcat is quite easy to configure .. if you get the binary distribution simply unpack and run
LOCATION_OF_TOMCAT/bin/startup.sh point your browser to http://localhost:8080/ and you are off! There are jsp exmples and test webapps you can use as templates Here are some quick hints to get you started. 1. As root mkdir /usr/java (This is where I keep my java stuff not good reason ) 2. As root chown yourUsername:yourGroup /usr/java 3. Download the Linux J2SDK (self-extracting file j2sdk-1_4_2_04-linux-i586.bin, 34.17 MB ) from sun to the /usr/java dir and do the following chmod 755 j2sdk-1_4_2_04-linux-i586.bin ./j2sdk-1_4_2_04-linux-i586.bin 4. Make a simlink to the dir you just unpacked to j2sdk cd /usr/java ln -s /usr/java/j2sdk-1_4_2_04 ./j2sdk 5. In your home dir edit your .bash_profile and add the following lines export JAVA_HOME=/usr/java/j2sdk export CLASSPATH=. 6. Download and unpack tomcat to /usr/java dir 7. run this command source ~/.bash_profile 8. Start tomcat /usr/java/jakarta-tomcat-5.0.18/bin/startup.sh *sub jakarta-tomcat-5.0.18 for the version of tomcat you have . 9. Point your browser to http://localhost:8080/ -Matt |
very cool. thanks for the tips. ill try that when i get home tonight
|
Quote:
Quote:
I have a web server running Apache and I would like to use JSP to simplify my life. Thanks in advance, ian |
Quote:
Based on what I understand you will need to install Tomcat in order to run jsp and serverlets on Apache. Apache is really just the web server only. The module mod_jk is required to be installed as a conector in order for Apache to talk to Tomcat server. More info can be found. http://jakarta.apache.org/tomcat/tom...k/aphowto.html Hope this helps.... |
Tomcat is a full HTTP server, Apache is not needed to run Tomcat or serve jsp's. There are in fact modules that will compile jsp's in Apache but are not recommended as they do not provide a full Java environment. mod_jk is a connector for Apache
, it works like mod_rewrite and/or mod_proxy, this helps to split static and dynamic content as Apache is traditionally faster at serving up static content then Tomcat. If you are running a small site, tomcat alone will be fine. The benefit of using tomcat over a simple module that can compile and serve jsp's is that you get the full Java servelt environment. Some benefits include, built in session tracking and management, access to your home brew Java objects in your jsp's and servlets, custom tag libraries that can help you build large complex pages by using your own custom tags. The list goes on and on but those are some highlights. -Matt |
Quote:
|
Ok... Tomcat seems like what I'm going to learn next; however, I've read that you need Apache if you are planning on using such things as databases or languages like PHP.
Would Tomcat handles those things? Thanks, ian |
Java can interface with databases via JDBC. PHP can be executed as a CGI binary, so assuming Tomcat can handle CGIs (I think it can, but I'm not positive -- only started playing around with it myself), you can use PHP through it.
|
Quote:
Quote:
ian |
Let me try and clear up some confusion. Tomact is a Java specific application server. Tomcat can process JSP's, execute servelets, serve static content including HTML, and images. Tomcat known as a container provides a full Java environment for JSP's and servlets as well as any other supporting classes. The container adheres to a sun specification for deployment of Java applications.
Here are some links that provide more background as well as a tutorial. http://java.sun.com/developer/online.../contents.html http://www.visualbuilder.com/jsp/tutorial/jspintro.asp Tomcat can not execute php or other scripting languages. You can connect to databases through Java but that is not a function of Tomcat, however as described above, Tomcat can execute any supporting classes you need including JDBC driver classes. You do not need Apache in any way to use Tomcat. If you have all Java or static html content then you don't need Apache at all. mod_jk is not in any way required, in fact it is highly unlikely you will need mod_jk. A word of caution there is a lot to learn when it comes to Java server side technologies. Start small. Build you site or test site with JSP's only, then add some servelets. Pick up some books. http://www.amazon.com/exec/obidos/tg...glance&s=books http://www.amazon.com/exec/obidos/AS...589171-5104711 |
All times are GMT -5. The time now is 04:24 PM. |