Hi Venkata ,
Why not have a helper class which reads the location of your file from the
runtime variable "server.root" which is provided the startServer.bat as well
as in startServerBasic.bat in WAS_ROOT/bin?
In your case , you can modify either the startServer.bat or
startServerBasic.bat(whichever you are using) and supply a runtime
environment variable as the relative path of your file.
e.g
startServer.bat
===============
%JAVA_HOME%\bin\java -Dserver.root=%WAS_HOME%
-Dws.def.olt.host=%DEFAULT_OLT_HOST% -Dws.def.olt.port=%DEFAULT_OLT_PORT%
-Dws.def.jdwp.port=%DEFAULT_JDWP_PORT% -Djava.ext.dirs=%EXT_DIRS%
com.ibm.websphere.install.commands.ProcessLauncherTest %
You can modify this by adding -DpropFilePath=./properties to this command.
You can put the properties file in the "properties" folder under WAS_ROOT.
In your helper class code , you can do a System.getProperty("propFilePath")
depending upon the value assign the relative path of the file. For WAS4.0 ,
it would be "./properties" .
Actually "portablity" is a big word. It can be construed as
1)Portability across appservers
2)Portability across versions of the same appserver.
3)Portability across operating systems
You can extend the above solution to check the version of the appserver or
the appserver name also by accordingly supplying additional env variables.
Let me know if this solution suits you.
Regards,
- Rahul
> -----Original Message-----
> From: Venkata Reddy Vajrala [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 19, 2002 9:05 AM
> To: [EMAIL PROTECTED]
> Subject: Reading file from Servlet, EJB, JSP using a common class
>
>
> Hi,
>
> I am using WebSphere Application Server 4.0 AE (WAS 4.0 AE).
>
> How do we specify the path to read a file from Servlet, EJB,
> JSP using a
>
> common class? I.e., Suppose I have written a class CLogger.java that
> reads from and writes to a txt file. It has methods each of which
> accepts file path parameter. Now my question is, what should be the
> value of file path parameter while accessing from Servlet/JSP/EJB?
> Where should I place the txt file to be available for CLogger? My
> CLogger is a generic class that can be accessed from any of JSP,
> Servlet, or EJB(Web module and EJB module).
>
> I thought that reading WAS's server.root property from the
> admin.config
> file would solve my problems, as I can give absolute path by appending
> relative path to "server.root" value. But I donot know how
> to get this
> value from a Web component. I cannot hard code the path of
> admin.config
>
> file. If I do so, my application will not be portable across
> operating
> systems.
>
> These are the doubts bothering me for a long time. Help me please.
>
> thanks in advance,
>
> Venkat.
>
> ==============================================================
> =============
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff EJB-INTEREST". For general help,
> send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".