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.

Datein mit Java ausführen

Empfohlene Antworten

Veröffentlicht

Hi

Ich soll so ne art Notoncommander basteln, mit dem ich auch datein ausführen kann nur ich hab so kein plan wie das geht geschweige denn wo ich mich da schlau lesen kann. kann mir wer nen tip geben????

Thx

Ich behaupte einfach mal aus dem Bauch heraus (muß also nicht stimmen), daß das nicht geht. Java's hochgepriesene Plattformunabhängigkeit macht das wohl unmöglich.

Theoretisch mußt Du herausfinden, welches Programm mit welchen Dateien geöffnet werden kann. Windows stellt die Infos in der Registry bereit. Wie Linux das macht, weiß ich nicht. Zumal bei Linux erst eine GUI die Funktionalität mitbringt (behaupte ich jetzt einfach so). Und wie das auf einem Mac aussieht, ... keine Ahnung.

Daher wird es nicht grad einfach werden.

Unter Windows gehts so. Linux hab ich noch nicht ausprobiert:


public static void doRun(File file) throws IOException {

 StringBuffer sb = new StringBuffer("cmd /c start ");

 sb.append(file);

 Process proc = Runtime.getRuntime().exec(sb.toString());

}

Runtime sollte eigentlich überall funktioniern.

Du müsstest nur sowas wie eine Datenbank haben, die jedem Typ ein Programm zuordnet.

Damit wäre der Programmierteil plattformunabhängig.

Runtime sollte überall funktionieren. Wenn man auch vom System eine solche DB abfragen kann, kommt man schon sehr weit.

Mich trübt aber noch etwas: Windows sichert die Programme zu den Typen ohne Pfad, also nur der Name der .exe-Datei. Wenn jetzt aber der Pfad auch nicht in der PATH-Variablen steht, kann das System nichts mit der .exe anfangen.

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.