?
Solved

If i use System.getProperties("") From where it gets the value.

Posted on 2003-03-31
8
Medium Priority
?
320 Views
Last Modified: 2008-03-06
If i use System.getProperties("") From where it gets the value. we are facing some problems in coding.the old maintaince code is returning hard coded value (C:\Input)when i am using System.getProperties("TestDirectory").But when it deploying in solaris we don't have that root. I find out and came to know that some where in System properties he is keeping. where this values are storing and where i will get Please help me. Thanks in advance.

0
Comment
Question by:raghugan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:raghugan
ID: 8238542
It's working with windows but not with solaris
0
 
LVL 35

Expert Comment

by:TimYates
ID: 8238918
it's either:

1) A Properties file on the classpath
2) From the command line
3) A properties file loaded by name

So;
1) Search for any files on the system with "C:\Input" in them (this should work on Solaris)

find / -type f -exec grep 'C:\\Input' {} \; -ls

2) Check the startup script for -D parameters
3) Check his sourcecode for "Properties" classes

Anyway the find thing should show you where it's getting it from...
0
 

Author Comment

by:raghugan
ID: 8238989
We tried all above options.
I tried this also

import java.io.FileInputStream;
import java.util.Properties;

public class PropertiesTest {
public static void main(String[] args) throws Exception {
// set up new properties object
// from file "myProperties.txt"
FileInputStream propFile = new FileInputStream(
"myProperties.txt");
Properties p = new Properties(System.getProperties());
p.load(propFile);

// set the system properties
System.setProperties(p);
// display new properties
System.getProperties().list(System.out);
}
}

But the problem is it's working only for that session.
I wrote one more PropertiesTest1 and looked the variables what i set in "myProperties.txt". It's not displaying the values.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 35

Expert Comment

by:TimYates
ID: 8239159
You tried

find / -type f -exec grep 'C:\\Input' {} \; -ls

on the Solaris machine with the source code installed?

You want to find the bloke who did that, and slap him... ;-)
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 80 total points
ID: 8239832
If the property TestDirectory is not appropriate for the OS, why not just override it?

String testDirectory = System.getProperty("TestDirectory");
if (testDirectory.indexOf("\\") > -1) {
  // override
  System.setProperty("TestDirectory", "/usr/local/test");
}
0
 

Expert Comment

by:CleanupPing
ID: 9058369
raghugan:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9735905
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept CEHJ's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question