Solved

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

Posted on 2016-11-18
20
80 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
[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
  • 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

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
 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
This video teaches viewers about errors in exception handling.

691 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