Visualizzazione dei risultati da 1 a 10 su 16

Hybrid View

  1. #1
    Ho trovato questo...
    codice:
    String path =Test.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    String decodedPath =URLDecoder.decode(path,"UTF-8");
    Ma genera un errore nell'ActionPerformed(evt) del JButton che crea il file e dovrebbe anche visualizzare il path.

  2. #2
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284
    Quote Originariamente inviata da Gas75 Visualizza il messaggio
    codice:
    String path =Test.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    String decodedPath =URLDecoder.decode(path,"UTF-8");
    Non servono questi truschini.

    codice:
    File f = new File("pippo.dat");
    String pathAssoluto = f.getAbsolutePath();

    java.io.File è perfettamente in grado di "risolvere" un percorso relativo in uno assoluto.
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.