Question

JAVA_HOME environtment variable ? - Tomcat on a Virtual FreeBSD Server with JDK1.4

Asked by: 68_beagles

Hello

How do I set the JAVA_HOME environment variable

I am using a virtual Free BSD server, which means that I don't have root access, only telnet/SSH access.


The hosting company installed JDK1.4 (upgrade from 1.1.18)

..now I need tomcat installed.
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.24/bin/jakarta-tomcat-4.1.24.tar.gz

I installed as per these direction:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/RUNNING.txt


When I run Tomcat I receive this error

     prompt% pwd
     /usr/local/jakarta-tomcat-4.1.24/bin
     prompt% startup.sh
     The JAVA_HOME environment variable is not defined
     This environment variable is needed to run this program
     prompt%


if this helps
     prompt% echo $shell
     /usr/local/bin/tcsh
     prompt%


I thought I might need to change something in my   .cshrc  file, but I am not sure. This is going further then I know.
here is a copy of the current  .cshrc file. Changes were made in here for the JDK, and PostgrSQL

******************************
     set path= (~/usr/local/jakarta-tomcat-4.1.24/bin ~/usr/local/j2re1.4.1_02  
/usr/local/j2re1.4.1_02/bin  /bin /usr/bin /usr/local/bin ~/bin ~/usr/bin ~/usr/local/bin)

    if (! $?prompt) exit

     set history      = 100
     set prompt      = "`hostname -s`% "

     unalias *

     alias h            history
     alias ll      ls -l
     alias la      ls -la
     alias www      cd www/htdocs/

     setenv BLOCKSIZE      1k
     setenv EDITOR            vi
     setenv PAGER            more

     umask 022

     if (! $?term) set term = vt100

     stty echoe erase ^H kill ^U intr ^C quit ^\| susp ^Z
     setenv PORTSDIR "$HOME/usr/ports"
     setenv PREVIX "$HOME/usr/local"

     setenv PGDATA /usr/local/pgsql/data
     setenv PGLIB /usr/local/pgsql/lib
     setenv LD_LIBRARY_PATH /usr/local/gpsql/lib
     set path = (/usr/local/pgsql/bin $path)
**************************************

Any direction or any help would be great.

if you are wondering why the hosting company does not help, this is not a product that they support.


on another note, is there a way to change my prompt to show my path??

Thanks

David

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-05-22 at 11:38:41ID20623603
Tags

java_home

,

defined

,

variable

,

freebsd

,

tomcat

Topics

OpenBSD

,

Server Side Includes (SSI)

Participating Experts
3
Points
115
Comments
11

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Problem in Tomcat over FreeBSD connection to DataBase
    I have JSP running over Apache Tomcat with MYSQL as BackEnd and operating system is Free BSD . i hva ealready configuerd it properly and it was up and running but due to some reason we had to resatrt our tomcat by start and stop. fater that tomcat has restarted but it is not ...
  2. Tomcat Startup
    We have itools installed and we run Apache and Tomcat. Recently we upgraded all servers, and after upgrade the Tomcat wouldn't start. After the install we get a file with no name in the root directory, the file's content is very similar to web.xml file's content, but I canno...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: mlafortunePosted on 2003-05-22 at 12:35:08ID: 8567022

You just have to set JAVA_HOME in your .cshrc it will be something like:

setenv JAVA_HOME /the/home/of/the/jre

You have to logoff and login back for the change to apply, once you've done that you can double check that everything went ok by doing

echo $JAVA_HOME

at the prompt, this should give you the /the/home/of/the/jre you entered in the .cshrc

 

by: 68_beaglesPosted on 2003-05-22 at 13:34:16ID: 8567375

Thanks,

one step closer.  It is nice to know that the variable does show up when I echo.  

The problem is I am not pointing to the correct spot, because it still gives me the same error.


usr/local
              /j2re1.4.1_02
                                    /bin


I have tried all these dir combonation, and still no go.  Which file is it looking for so I can make sure I am going to the right dir.  I did not do the install of the JDK1.4, so I am only assuming that this is the correct location, based on the path settings.

David

 

by: mglxxxPosted on 2003-05-22 at 23:57:14ID: 8569899

First find out where java actually is:
which java

This should print something like:
/usr/local/j2re1.4.1_02/bin/java  

The JAVA_HOME in this case should be
/usr/local/j2re1.4.1_02

Check whether there's a typo in your path setting.
I'd expect java to reside in /usr/local/j2se1.4.1_02 instead of /usr/local/j2re1.4.1_02.

 

by: gheistPosted on 2003-05-23 at 08:43:57ID: 8572860

And sometimes java needs to be in your path

(ksh .profile, not cshrc format)

JAVA_HOME=/usr/local/j2se1.4.1_2
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH

ant then run java -version to check if it is correctly found

 

by: 68_beaglesPosted on 2003-05-23 at 12:54:45ID: 8574440

still getting closer.

I have a copy of the session below (changed the domain and login info)
I have a copy of the   .cshrc file below as well

I notice that the path of Java comes up with the long version, which means that I would have to append the first part of the path, like gheist suggested. not sure which file to do that in.  I did not find a  .profile  file.

I tried it in the  .cshrc  file, by adding  waht gheist suggested, as well  I added    /usr/home/john_doe/  - but that didn't work

one other point to add to the mix.  Because this is a virtual server, I have to type:
virutal ./startup.sh  to start tomcat.  would that make a differance??


David

*****  telnet session  ********************
     login as: john_doe
     Sent username "john_doe"
     john_doe@domain_name.com's password:
     Last login: Fri May 23 18:07:04 2003 from 154.5.238.171
     FreeBSD 4.4-RELEASE (VKERN) #9: Thu Jan  2 10:23:51 MST 2003

    domain_name% echo $path
    /usr/local/pgsql/bin /usr/home/john_doe/usr/local/jakarta-tomcat- 4.1.24 /usr/home/john_doe/usr/local/jakarta-tomcat- 4.1.24 /usr/home/john_doe/usr/local/j2re1.4.1_02 /usr/home/john_doe/usr/local/j2re1.4.1_02/bin /bin /usr/bin /usr/local/bin /usr/home/john_doe/bin /usr/home/john_doe/usr/bin /usr/home/john_doe/usr/local/bin
    domain_name%

    domain_name% echo $PATH
    /usr/local/pgsql/bin:/usr/home/john_doe/usr/local/jakarta-tomcat- 4.1.24:/usr/home/john_doe/usr/local/jakarta-tomcat-4.1.24:/usr/home/john_doe/usr/local/j2re1.4.1_02:/usr/home/john_doe/usr/local/j2re1.4.1_02/bin:/bin:/usr/bin:/usr/local/bin:/usr/home/john_doe/bin:/usr/home/john_doe/usr/bin:/usr/home/john_doe/usr/local/bin
    domain_name%

    domain_name% which java
    /usr/home/john_doe/usr/local/j2re1.4.1_02/bin/java
    domain_name%

    domain_name% echo $java_home
    java_home: Undefined variable.
    domain_name% echo $JAVA_HOME
    /usr/home/john_doe/usr/local/j2re1.4.1_02
    domain_name%

   domain_name% java -version
   java version "1.4.1_02"
   Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
   Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
   domain_name%exit

*****End of telnet session*********************************


********** .cshrc file  **********************

set path      = (~/usr/local/jakarta-tomcat-4.1.24 ~/usr/local/jakarta-tomcat-4.1.24 ~/usr/local/j2re1.4.1_02 ~/usr/local/j2re1.4.1_02/bin  /bin /usr/bin /usr/local/bin ~/bin ~/usr/bin ~/usr/local/bin)

if (! $?prompt) exit

set history      = 100
set prompt      = "`hostname -s`% "

unalias *

alias h            history
alias ll      ls -l
alias la      ls -la
alias www      cd www/htdocs/

setenv BLOCKSIZE      1k
setenv EDITOR            vi
setenv PAGER            more

umask 022

if (! $?term) set term = vt100

stty echoe erase ^H kill ^U intr ^C quit ^\| susp ^Z
setenv PORTSDIR "$HOME/usr/ports"
setenv PREVIX "$HOME/usr/local"

setenv PGDATA /usr/local/pgsql/data
setenv PGLIB /usr/local/pgsql/lib
setenv LD_LIBRARY_PATH /usr/local/gpsql/lib
setenv JAVA_HOME /usr/home/john_doe/usr/local/j2re1.4.1_02
set path = (/usr/local/pgsql/bin $path)

********** End of  .cshrc file  **********************

 

by: gheistPosted on 2003-05-24 at 00:24:20ID: 8576525

Can you run "java" command ??? This is the most important step, tomcat will not run without java.

for cshrc:
setenv JAVA_HOME /usr/local/j2se1.4.1_2
setenv PATH ( $PATH $JAVA_HOME/bin )

(put in the end)

 

by: 68_beaglesPosted on 2003-05-27 at 18:01:12ID: 8594393


Yes,

I can run Java
I can run Javac
I can run Java -version
  domain_name% java -version
  java version "1.4.1_02"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
  Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)


when I added
  setenv JAVA_HOME /usr/local/j2se1.4.1_2
  setenv PATH ( $PATH $JAVA_HOME/bin )
to the  .cshrc  file

and run  /urs/loca/jarkarta-tomcat4.1.12/startup.sh

I received an error:
   domain_name% ./startup.sh
   /usr/home/user_name/usr/local/jakarta-tomcat-4.1.24/bin/setenv.sh: /usr/home/user_name/usr/local/j2re1.4.1_02/bin: permission denied
   The JAVA_HOME environment variable is not defined correctly
   This environment variable is needed to run this program
when I log in


this is a copy of my   .cshrc  file:


is there anything else that I can do to help figure this out.???

thanks again

David
*****************
set path      = (~/usr/local/jakarta-tomcat-4.1.24 ~/usr/local/jakarta-tomcat-4.1.24 ~/usr/local/j2re1.4.1_02 ~/usr/local/j2re1.4.1_02/bin  /bin /usr/bin /usr/local/bin ~/bin ~/usr/bin ~/usr/local/bin)

if (! $?prompt) exit

set history      = 100
set prompt      = "`hostname -s`% "

unalias *

alias h            history
alias ll      ls -l
alias la      ls -la
alias www      cd www/htdocs/

setenv BLOCKSIZE      1k
setenv EDITOR            vi
setenv PAGER            more

umask 022

if (! $?term) set term = vt100

stty echoe erase ^H kill ^U intr ^C quit ^\| susp ^Z
setenv PORTSDIR "$HOME/usr/ports"
setenv PREVIX "$HOME/usr/local"

setenv PGDATA /usr/local/pgsql/data
setenv PGLIB /usr/local/pgsql/lib
setenv LD_LIBRARY_PATH /usr/local/gpsql/lib
set path = (/usr/local/pgsql/bin $path)

setenv JAVA_HOME /usr/local/j2se1.4.1_2
setenv (PATH $PATH $JAVA_HOME/bin)
*********************

 

by: mlafortunePosted on 2003-05-27 at 19:56:11ID: 8594831

From that line...
/usr/home/user_name/usr/local/jakarta-tomcat-4.1.24/bin/setenv.sh: /usr/home/user_name/usr/local/j2re1.4.1_02/bin: permission denied

We can tell it's probably trying to excute the directory directly, maybee you can have a look at the /usr/home/user_name/usr/local/jakarta-tomcat-4.1.24/bin/setenv.sh
It may try to do something like $JAVA_HOME/$JAVA_BIN something
if JAVA_BIN is not define you will get that error (Permission denied on the directory) you really should have a look (and maybee paste the relevant part here) in the setenv.sh script

To see what it's trying to do with the $JAVA_HOME var, or you can try to set your $JAVA_HOME as the full path to Java including the excutable.

Hope this help!

 

by: gheistPosted on 2003-05-28 at 00:27:53ID: 8596034

have a look at my running Tomcat:

setenv JAVA_HOME /usr/local/jdk-1.3.1
!!!!! this seems to be missing
setenv CATALINA_HOME /home/tomcat/tomcat-4.0.6
!!!!! I have 128M ram and want to limit it to 64M (ulimit == 64m+25% I wonder if there is a problem???)
ulimit -m 81920
setenv CATALINA_OPTS -Xmx64m
!!!!! and cd to dir, important app so i did not reboot to check
cd $CATALINA_HOME/bin
./startup.sh

 

by: gheistPosted on 2003-05-28 at 00:55:29ID: 8596176

this seems important too
setenv CLASSPATH ($JAVA_HOME/lib $CATALINA_HOME/lib )

 

by: 68_beaglesPosted on 2003-06-03 at 10:22:02ID: 8640710

thanks for all the info, it did help with just learning a few things about the OS and tomcat / Java.

I am onto another problem and so I have posted another question

thanks again

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...