Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Systemvariablen

Empfohlene Antworten

Veröffentlicht

Moin, moin!

Hat jemand ein einfaches Beispiel um Systemvariablen unter JAVA abzufragen?

MfG Burgi

Würde mich auch mal interessieren, wie lese ich z.B. den Benutzernamen, des angemeldeten Benutzers aus?

Grüsse BMAS

Das is eigentlich nich so das Problem,

du solltest über die Klasse System da ran kommen. Lies dir mal die API-Spezifikation durch. Ich hab das auch noch nich gemacht, aber n Arbeitkollege und der hat Nutzername ausgelesen usw.

Also, Versuch macht kluch ;)

So, hab eben noch mal in die API geschaut und mit

System.getProperties(); kann man die Systemproperties

rausholen. dann mit getProperty (String key) kann man eine Systemeinstellung rausholen. Wenn ihr alle Schlüssel haben wollt macht das mit keySet() (Set als Rückgabe) oder mit keys (Enumeration als Rückgabe). Lasst euch einfach mal alle Schlüssel ausgeben und dann holt sie euch einfach ;)

Sollte funzen.

Bis denn

Danke erstmal. Werde ich mal ausprobieren.

MfG Burgi

Also ich hab das mit dem System.getProperties() ausprobiert. Das ist auch gut und bringt mich anderweitig weiter. Doch meinte ich eigentlich die Systemvariablen, die du unter MS-DOS mit "set" abrufst.

Oder geht das auch damit????

MfG Burgi

_________________________________________________________

Donnerstag Zwischenprüfung:*bibber*

Du müßtest Dir mal alle Schlüssel aus den Properties holen. Ob da die Umgebungsvariablen mit drin stehn,weiss ich nich. Versuch macht kluch ;)

Ok!

Probier ich mal weiter!

Nochmals Thx!

MfG Burgi

__________________________________________

Doch schon Mittwoch die ZP: *bibberbibber*

Hallo,

mit:

-----------------------------------

public class test {

  public static void main(String args[]){

    System.getProperties().list(System.out);

  }

}

-----------------------------------

bekommst du ungefähr diese Ausgabe.

-----------------------------------

-- listing properties --

java.runtime.name=Java 2 Runtime Environment, Stand...

sun.boot.library.path=C:\jdk1.3.1\jre\bin

java.vm.version=1.3.1-b24

java.vm.vendor=Sun Microsystems Inc.

java.vendor.url=http://java.sun.com/

path.separator=;

java.vm.name=Java HotSpot Client VM

file.encoding.pkg=sun.io

java.vm.specification.name=Java Virtual Machine Specification

user.dir=C:\MyProjects\test

java.runtime.version=1.3.1-b24

java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment

os.arch=x86

java.io.tmpdir=C:\DOKUME~1\xxx\LOKALE~1\Temp\

line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.

java.awt.fonts=

os.name=Windows 2000

java.library.path=C:\jdk1.3.1\bin;.;C:\WINNT\System32;C...

java.specification.name=Java Platform API Specification

java.class.version=47.0

os.version=5.0

user.home=C:\Dokumente und Einstellungen\xxx

user.timezone=

java.awt.printerjob=sun.awt.windows.WPrinterJob

file.encoding=Cp1252

java.specification.version=1.3

user.name=xxx

java.class.path=C:\MyProjects\test...

java.vm.specification.version=1.0

java.home=C:\jdk1.3.1\jre

user.language=de

java.specification.vendor=Sun Microsystems Inc.

awt.toolkit=sun.awt.windows.WToolkit

java.vm.info=mixed mode

java.version=1.3.1

java.ext.dirs=C:\jdk1.3.1\jre\lib\ext

sun.boot.class.path=C:\jdk1.3.1\jre\lib\rt.jar;C:\jdk1.3....

java.vendor=Sun Microsystems Inc.

file.separator=\

java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...

sun.cpu.endian=little

sun.io.unicode.encoding=UnicodeLittle

user.region=DE

sun.cpu.isalist=pentium i486 i386

--------------------------------

Umgebungsvariablen konnte man früher mit System.getenv("PATH") auslesen. Diese Funktion ist aber deprecated.

Gruß Jaraz

Hm...

System.getenv(String) ist eigentlich, glaube ich genau, was ich brauche.

Doch leider funzt der ja nicht mehr. Trotzdem danke!

MfG Burgi

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.