Solved

what is a "java.lang.System Property"   ?

Posted on 2016-11-18
20
41 Views
Last Modified: 2016-12-01
What is a Java system property and where is it stored ?
I need someplace to persist values that are not on the drive, and wanted to know if saving values to the system properties is acceptable ?

Is there any type of size limit ?

Thank you.
0
Comment
Question by:sidwelle
  • 10
  • 8
20 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 41893630
The system properties are found in the jvm itself. They are not persisted. So you would need another mechanism
0
 

Author Comment

by:sidwelle
ID: 41893648
Not persisted:  I find that each time I go back chk the value its still there.
Not persisted across "reboots" ? or environment stops and starts ?
 
That's why I ask where they are stored ?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41893654
When i say 'not persisted',  i really mean that they are not a persistence mechanism.
Tell us more about your goal
0
 

Author Comment

by:sidwelle
ID: 41893665
I have a table that I am loading from a file and I don't want to load it each time the JavaScript is called.
I was trying to find some mechanism that I could use to store a string value.

Only retrieve the table is the table value was empty or the date of the table in memory and date on the file don't match.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41893670
'Javascript'? That has nothing to do with Java System properties
0
 

Author Comment

by:sidwelle
ID: 41893717
I am using a product where the authors have made JavaScript available as a utility to manipulate values.
We are calling Java objects from JavaScript, sorry if its confusing.

Is the System Properties a suitable place to store values ?
Is there anther mechanism w/in Java to store and retrieve values ?

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41893729
Is the System Properties a suitable place to store values ?
In a word, no. The system decides what goes in there and anyway it's not a persistence mechanism really. It's really environment variables for Java
0
 

Author Comment

by:sidwelle
ID: 41893738
Can you suggest another place ?
0
 

Author Comment

by:sidwelle
ID: 41893764
If I have a server that up for Months at a time, and I need a place to store sting values, how is different from an environment variable found in the O.S.  ?  It serves as a place for the apps to store values about the environment.  How is this different from a property bag that a ActiveX control would keep.  only difference is that I have to repopulate after a reboot ?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 86

Expert Comment

by:CEHJ
ID: 41893796
Any persistent variable resides on disk. In the case of Windows, in the registry. In the case of Unix in scripts that are sourced on startup. So if you want to persist something, it will have to be some disk somewhere
0
 

Author Comment

by:sidwelle
ID: 41894279
The Javascripts are stateless with no native way to store values, so I was looking some place to store values between script calls.  The scripts are called several times a minute, so I did not want to create script that would thrash the disk by calling it several times a minute 24x7.

Would it be possible to write to a memory location that live between scripts executions and not write to the disk ?

Thank you.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41894313
Surely you would only write it when the value changed from the previous one?
0
 

Author Comment

by:sidwelle
ID: 41894345
Yes, but then I have to read the whole file and parse for the value that I want.
Didn't want to do that several times a minute.

Be a lot nicer if I have place to stick in memory and then only read the file if the value was empty or outside of hardcoded tolerances.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41894368
Very difficult to comment constructively without knowing the specifics of what you're doing
0
 

Author Comment

by:sidwelle
ID: 41894477
Simply trying to make this product do more than it was intended.

Probably the same reason that cookies were invented for the browser, I just need somewhere to store some values and I was trying to avoid using the drive.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 41894694
Well cookies, which you may not be able to use anyway if  you're running client-side scripts, also work by writing to the drive
0
 

Author Closing Comment

by:sidwelle
ID: 41909110
I accept what you are stating, I will just have to look somewhere else to try and persist some values.

Thanks
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 41909130
If you were using Javascript, you could have tried using Local storage of HTML 5, check: https://developer.mozilla.org/en/docs/Web/API/Window/localStorage
0
 

Author Comment

by:sidwelle
ID: 41909520
I am not in a browser !
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now