473,387 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do we find installation directory for a server developed in java

Hi

I'm developing a server in Java. I need to read/write certain files in
my server code, for which I need the exact location of files.

In C++, normally this is achieved by having a system variable like
SERVER_HOME and using this variable in the code. This variable can be
set by Installer.

What is the way for achieving this in Java.

Also my server is actually a web-app which will run in some app
server.

thanks,
Naresh
Jul 17 '05 #1
3 3767
I've done similar things using properties files:

http://java.sun.com/j2se/1.4.1/docs/...roperties.html

Your installer can create a properties file in the user's home
directory (or some other well-known location) and then each time the
program starts up, it looks to that file.

Alternatively, you can set a Java system variable through the command
line that starts your application. For example, this set a variable
called 'fileLocation' to '/usr/local/random.conf':

java -DfileLocation=/usr/local/random.conf MyClassFile

Then, you access it your code using the System.getProperty(String)
method.

You would think Java would be able to interact with environment
variables, but I've never seen a clean way to do this.

-Nathan

na******@informatica.com (Naresh Agarwal) wrote in message news:<2b**************************@posting.google. com>...
Hi

I'm developing a server in Java. I need to read/write certain files in
my server code, for which I need the exact location of files.

In C++, normally this is achieved by having a system variable like
SERVER_HOME and using this variable in the code. This variable can be
set by Installer.

What is the way for achieving this in Java.

Also my server is actually a web-app which will run in some app
server.

thanks,
Naresh

Jul 17 '05 #2
The reason java does not do anything with env variables
is that they are OS specific thus not portable which is a
java tenant.

"Nathan Zumwalt" <na*****@hotmail.com> wrote in message
news:52**************************@posting.google.c om...
I've done similar things using properties files:

http://java.sun.com/j2se/1.4.1/docs/...roperties.html

Your installer can create a properties file in the user's home
directory (or some other well-known location) and then each time the
program starts up, it looks to that file.

Alternatively, you can set a Java system variable through the command
line that starts your application. For example, this set a variable
called 'fileLocation' to '/usr/local/random.conf':

java -DfileLocation=/usr/local/random.conf MyClassFile

Then, you access it your code using the System.getProperty(String)
method.

You would think Java would be able to interact with environment
variables, but I've never seen a clean way to do this.

-Nathan

na******@informatica.com (Naresh Agarwal) wrote in message

news:<2b**************************@posting.google. com>...
Hi

I'm developing a server in Java. I need to read/write certain files in
my server code, for which I need the exact location of files.

In C++, normally this is achieved by having a system variable like
SERVER_HOME and using this variable in the code. This variable can be
set by Installer.

What is the way for achieving this in Java.

Also my server is actually a web-app which will run in some app
server.

thanks,
Naresh

Jul 17 '05 #3
excuse my spelling, i meant tenent

"Phil..." <ry***@ieee.org> wrote in message
news:ACkcb.564637$YN5.399546@sccrnsc01...
The reason java does not do anything with env variables
is that they are OS specific thus not portable which is a
java tenant.

"Nathan Zumwalt" <na*****@hotmail.com> wrote in message
news:52**************************@posting.google.c om...
I've done similar things using properties files:

http://java.sun.com/j2se/1.4.1/docs/...roperties.html

Your installer can create a properties file in the user's home
directory (or some other well-known location) and then each time the
program starts up, it looks to that file.

Alternatively, you can set a Java system variable through the command
line that starts your application. For example, this set a variable
called 'fileLocation' to '/usr/local/random.conf':

java -DfileLocation=/usr/local/random.conf MyClassFile

Then, you access it your code using the System.getProperty(String)
method.

You would think Java would be able to interact with environment
variables, but I've never seen a clean way to do this.

-Nathan

na******@informatica.com (Naresh Agarwal) wrote in message

news:<2b**************************@posting.google. com>...
Hi

I'm developing a server in Java. I need to read/write certain files in
my server code, for which I need the exact location of files.

In C++, normally this is achieved by having a system variable like
SERVER_HOME and using this variable in the code. This variable can be
set by Installer.

What is the way for achieving this in Java.

Also my server is actually a web-app which will run in some app
server.

thanks,
Naresh


Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Si | last post by:
Hi, I am having trouble with an install of Oracle 9i Release 2 on Linux Mandrake 9.1. I have 512 MB DDR RAM and a Duron 850 CPU. The install appeared to run fairly seamlessly except for a...
1
by: srihari | last post by:
Hai, I am trying to install IBM DB2 8.1 on Red Hat linux 8.0. My machine is Intel XEON 64bit. The installation went well except for the creation of tools catalog. When I tried to install the tools...
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
20
by: piggy | last post by:
I have developed an application using C# under .NET 2.0 framework. It is almost done and it is time for me to think about deploymnet to all users. I don't have any background about this and would...
0
by: Brad Baker | last post by:
Our developers are calling a java application from an ASP/ASP.net page. Excerpt as follows: ---- Dim a_jvmargs(1) a_jvmargs(0)= "-Djava.class.path=C:\Program...
4
by: James | last post by:
I am going to install DB2 version 9 on Windows XP workstation. But I can not continue the installation after I issue the command "setup /i en". System shows me that "A major error occoured while...
0
by: SimoneB | last post by:
I'm trying to install eClient v 8.3 but during configuration Web application server i get the error: "the configuration of eclient failed while creating the web aplication server....
0
by: nimjerry | last post by:
i am using db2 udb V 9 on aix 5.3 and in db2diag.log alwas has this error occurr below is sample message 2008-03-03-09.45.34.366406+420 I306667A443 LEVEL: Warning PID : 835622 ...
0
by: zaza24 | last post by:
Hello there I am loosing my time since a few days trying to install a CRM (ACT! 2008 version 10) software on a brand new HP notebook with Vista prof OS. Ths installation do not show any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.