What is the best way to get information about a particular Java OS?

  • In particular, in Windows ".. \ Documents and Settings \ All Users", basically, any path that requires the interface to be dynamically obtained based on the OS on which your software runs. (Now I need an answer to this)
  • current users of My Documents dirctory (everything is in order) and the base any path that requires the front end to be dynamically obtained based on the OS on which your software is running.
+3
source share
3 answers

My documents are probably best handled by contacting:

System.getProperty("user.home");

System.getProperty.

+8

, ,

System.getProperty("...");

, , .

, ( ) . - ? , , :

System.getProperty("os.name");

, Windows, , , "C:\Documents & Settings\All Users \".

,

System.getProperty("user.home");

( ) . , , , .

+3

, Windows "..\Documents and Settings\All Users", , , , , . ( )

" " . KNOWNFOLDERIDs (CSIDL ). , Java .

I think that in this particular Windows folder there is no equivalent for other operating systems. In addition, the Documents and Settings \ All Users folder is present only in the latest versions of Windows, and everything happens differently, for example, for Windows 2000 or XP.

If you really need this information, you should read Microsoft documents and import your own library or some script called by Runtime.exec to provide information to your java application.

0
source

Source: https://habr.com/ru/post/1696613/


All Articles