Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2003-03-31
8
Medium Priority
?
321 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
7 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

571 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