LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-10-2004, 09:52 PM   #1
Rv5
Member
 
Registered: Sep 2003
Distribution: RedHat9
Posts: 114

Rep: Reputation: 15
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?
 
Old 03-10-2004, 09:58 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
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
 
Old 03-10-2004, 10:09 PM   #3
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
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:
JAVA_HOME=/usr/java/j2sdk1.4.2_02
pathmunge $JAVA_HOME/bin after
export JAVA_HOME
i usually put it right after the if/fi path manipulation statement, but i'm not sure how your distro has this set up or how different you're /etc/profile file is compared to mine. you'll also need to put in the correct path of your java install. mine's just an example. also you may need to restart your login session or a reboot maybe required if that doesn't get java in your path. java will be in your path if you use the command "java -version" and you get the java version for the output.

anyhoo, hope this helps you.

Last edited by megaspaz; 03-10-2004 at 10:10 PM.
 
Old 03-10-2004, 10:19 PM   #4
mhiggins
Member
 
Registered: Feb 2004
Posts: 140

Rep: Reputation: 15
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
 
Old 03-11-2004, 11:58 AM   #5
Rv5
Member
 
Registered: Sep 2003
Distribution: RedHat9
Posts: 114

Original Poster
Rep: Reputation: 15
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
 
Old 03-11-2004, 01:49 PM   #6
mhiggins
Member
 
Registered: Feb 2004
Posts: 140

Rep: Reputation: 15
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
 
Old 03-11-2004, 03:01 PM   #7
Rv5
Member
 
Registered: Sep 2003
Distribution: RedHat9
Posts: 114

Original Poster
Rep: Reputation: 15
very cool. thanks for the tips. ill try that when i get home tonight
 
Old 05-17-2004, 01:43 AM   #8
tumana
Member
 
Registered: Mar 2004
Posts: 102

Rep: Reputation: 15
Quote:
If you wish to write JSP pages an learn some Java you will need a container such as tomcat. --mhiggins
Quote:
Apache is a regular http webserver that is not able to process jsp pages. (Note there are some apache modules that allow for this) --mhiggins
Going along with what is talked about here, what is the advantage of having a whole new server, Tomcat, installed along side Apache versus installing a module for apache that understands JSP? I would think that the less installed and the less running would cause less to troubleshoot and maintain.

I have a web server running Apache and I would like to use JSP to simplify my life.

Thanks in advance,
ian

Last edited by tumana; 05-17-2004 at 01:45 AM.
 
Old 05-17-2004, 08:21 AM   #9
cyberpt
LQ Newbie
 
Registered: Jul 2003
Posts: 1

Rep: Reputation: 0
Quote:
Originally posted by tumana
Going along with what is talked about here, what is the advantage of having a whole new server, Tomcat, installed along side Apache versus installing a module for apache that understands JSP? I would think that the less installed and the less running would cause less to troubleshoot and maintain.

I have a web server running Apache and I would like to use JSP to simplify my life.

Thanks in advance,
ian

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....
 
Old 05-17-2004, 09:38 AM   #10
mhiggins
Member
 
Registered: Feb 2004
Posts: 140

Rep: Reputation: 15
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
 
Old 05-17-2004, 12:09 PM   #11
bentman78
Member
 
Registered: Mar 2003
Location: Washington DC, USA
Distribution: Redhat
Posts: 212

Rep: Reputation: 30
Quote:
Originally posted by cyberpt
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....
nope...you can proxy request to the tomcat server on port 8080 from Apache. I was in debate about his recently, and doing it this way is much easier.
 
Old 05-17-2004, 03:06 PM   #12
tumana
Member
 
Registered: Mar 2004
Posts: 102

Rep: Reputation: 15
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
 
Old 05-17-2004, 04:25 PM   #13
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 05-17-2004, 07:45 PM   #14
tumana
Member
 
Registered: Mar 2004
Posts: 102

Rep: Reputation: 15
Quote:
Originally posted by cyberpt
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....
Quote:
Originally posted by bentman78
nope...you can proxy request to the tomcat server on port 8080 from Apache. I was in debate about his recently, and doing it this way is much easier.
I've also heard that you can proxy certain pages to Tomcat from Apache through port 8080. It's funny that Apache Jakarta's website suggests to use the mod_jk as on the link above.

ian
 
Old 05-17-2004, 10:22 PM   #15
mhiggins
Member
 
Registered: Feb 2004
Posts: 140

Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get java in linux bruce3au Linux - General 2 10-07-2005 12:23 PM
linux + java alaios Linux - Software 7 07-26-2005 04:27 PM
JAVA:(jwstric2) Problems in JAVA-LINUX nedian123 Programming 1 06-28-2004 04:12 PM
Java for linux Odin_of_Asgard Programming 8 04-12-2004 08:59 PM
Linux and Java + Java Media Framework (JMF) perry Programming 0 11-03-2003 10:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration