Ho fatto così ma non funziona:
codice:
public void saveAs(){
    	JFileChooser chooser = new JFileChooser();
    	chooser.setCurrentDirectory( new File(getMyPath()) );
    	int returnVal = chooser.showSaveDialog (getFrame());
    	File f=null;
    	if (returnVal == JFileChooser.APPROVE_OPTION){
    	    f = chooser.getSelectedFile ();
    	    WriteFile wf;
    	    getPathName(f);
    	    System.out.println(pathSaved + ":" + nameSaved);
    	    try {
    	    	wf = new WriteFile(pathSaved,panel);
    	    	wf.writeFile();
    	    	isSaved=true;
    	    	frame.setTitle("Logic Ports - " + nameSaved);
    	    	isFirstSave=false;
    	    } catch (ParserConfigurationException e) {
    	    	e.printStackTrace();
    	    } catch (IOException e) {
    	    	e.printStackTrace();
    	    }  
    	}    	
    }
    
    private String getMyPath() {
        String str = Facade.class.getResource("Facade.class").toExternalForm();

        int start = 0;
        int end = str.indexOf("LogicPorts.jar");
        if ( str.startsWith("jar:") ) {
            start = 4;
        }

        if (str.indexOf("file:/") >= 0) {
            start += 6;
        }

        str = str.substring(start, end);
        str = str.replaceAll("%20", " ");

        return str;
    }
Entrambi i metodi sono posizionati nella classe Facade.
Mi da come errore String index out of bounds exception