How can I set environment variables for processes under the application server

View: New views
6 Messages — Rating Filter:   Alert me  

How can I set environment variables for processes under the application server

by MatEngel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Motivation:

I am working on a web application; it should run under Tomcat and access databases using JDBC.

One of the databases (Progress) seems to have a little unusual JDBC driver. It requires entries in the PATH environment variable, perhaps creating subprocesses outside of Java. That works fine if I write a plain application and set the PATH variable via DOS command SET. It works also fine under Tomcat. My problem is that I want to test in a NetBeans / GlassFish environment.



Question:

How can I set the PATH environment variable that is used in the application server and its subprocesses during debug from NetBeans? I did not find a place for it, using NetBeans 6.5.



Thanks in advance for your help!





Re: How can I set environment variables for processes under the application server

by Futaleufu_John :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can add the variable to your "global" path. The following procedure applies to Windows XP. I suspect the procedure is similar for Windows Vista.

Open Control Panel and double-click System to open the System Properties dialog. Click the Advanced tab. Click Environment Variables to open the Environment Variables dialog. Select Path and click Edit. Add your path variable to the Path. To add an environment variable, under System Variables click New and add the environment variable.

Now whenever you start a program, the added path or environment variable is available to the program.

You will probably have to restart NetBeans or the app server. I do not think you have to restart the computer.

MatEngel wrote:
One of the databases (Progress) seems to have a little unusual JDBC driver. It requires entries in the PATH environment variable, perhaps creating subprocesses outside of Java. That works fine if I write a plain application and set the PATH variable via DOS command SET. It works also fine under Tomcat. My problem is that I want to test in a NetBeans / GlassFish environment.

How can I set the PATH environment variable that is used in the application server and its subprocesses during debug from NetBeans? I did not find a place for it, using NetBeans 6.5.
Any ads or links to ads that appear in this post are not endorsed nor recommended by this poster.

How can I set environment variables for processes under the application server

by MatEngel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks John,



I think what you wrote is precisely how I did in a first attempt. I got the impression that it did not work that way, and that GlassFish switches to a own environment, independent of the environment on the computer.



I will recheck if this is true, or if it was another error that I did. However, I am on another place today, but I will do it tomorrow and report if the problem is solved.





How can I set environment variables for processes under the application server

by MatEngel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Unfortunately, it does not work. My guess is that GlassFish builds up the environment for its subprocesses from scratch. That is reasonable for me, for the applications will often be transferred to other computers, and it is better to see if something is missing before deployment. But there should also be a possibility to set the class path for the specific situation: debugging with NetBeans and GlassFish.



The problem is still open, for me.





Re: How can I set environment variables for processes under the application server

by emiddio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

dont remember start of this thread -- but glassfish lets you set some
properties from the admin screen;

also a possibility is to start glassfish by hand -- asadmin.bat; somewhere
in that sequence you maybe can set
what you want ??

gary

----- Original Message -----
From: "MatEngel" <Matthias.Engelhardt@...>
To: <nbj2ee@...>
Sent: Friday, March 06, 2009 5:38 AM
Subject: [nbj2ee] How can I set environment variables for processes under
the application server


> Unfortunately, it does not work. My guess is that GlassFish builds up the
> environment for its subprocesses from scratch. That is reasonable for me,
> for the applications will often be transferred to other computers, and it
> is better to see if something is missing before deployment. But there
> should also be a possibility to set the class path for the specific
> situation: debugging with NetBeans and GlassFish.
>
>
>
> The problem is still open, for me.
>
>
>
>


Re: How can I set environment variables for processes under the application server

by Clintona :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Under Glassfish 2.1 there's a $J2EE_HOME/config/asenv.conf file,
where it appears you can set environment variables.