ho cercato di farlo ma il risultato è stato:
"Exception in thread "main" : java.lang.NoSuchMethodError: main
codice:
import java.io.*;
import javax.swing.*;
import javax.swing.filechooser.*;
public class provaChooser {
private BufferedReader datRdf, protoRdf, newRead;
private BufferedWriter outRdf, finalRdf;
provaChooser() {
JFileChooser fileDati = new JFileChooser();
fileDati.addChoosableFileFilter (new FileNameExtensionFilter ("File XML", "xml", "File RDF", "rdf"));
int returnD = fileDati.showOpenDialog(provaChooser.this);
fileDati.setApproveButtonText("Open Data File");
if (returnD == JFileChooser.APPROVE_OPTION) {
File dat = fileDati.getSelectedFile();
datRdf = new BufferedReader(new FileReader(dat));
}
JFileChooser fileProto = new JFileChooser();
fileProto.addChoosableFileFilter (new FileNameExtensionFilter ("File XML", "xml", "File RDF", "rdf"));
int returnP = fileProto.showOpenDialog(provaChooser.this);
fileProto.setApproveButtonText("Open Prototype File");
if (returnP == JFileChooser.APPROVE_OPTION) {
File proto = fileProto.getSelectedFile();
protoRdf = new BufferedReader(new FileReader(proto));
}
JFileChooser fileFin = new JFileChooser();
fileFin.addChoosableFileFilter (new FileNameExtensionFilter ("File RDF", "rdf"));
int returnF = fileFin.showSaveDialog(provaChooser.this);
fileFin.setApproveButtonText("Save instance");
if (returnF == JFileChooser.APPROVE_OPTION) {
File newFile = fileFin.getSelectedFile();
newRead = new BufferedReader(new FileReader(newFile));
outRdf = new BufferedWriter(new FileWriter(newFile));
finalRdf = new BufferedWriter(new FileWriter(newFile));
}
}
//Metodo complete
void complete() {
try{
String inputLine = datRdf.readLine();
int beginInd = 0;
int apartInd = inputLine.indexOf("@");
int vdoInd = apartInd+1;
String ns = inputLine.substring(beginInd, apartInd);
String vdo = inputLine.substring(vdoInd);
outRdf.write(ns);
String pref = "<vdoext:h";
String protoLine;
while ((protoLine = protoRdf.readLine()) != null){
if (protoLine.startsWith(pref)) {
String end = "\"/";
String link = "link";
String virg = "\"";
int bInd = 35;
int eInd = (protoLine.indexOf(end));
link = protoLine.substring(bInd, eInd);
outRdf.newLine();
outRdf.write(protoLine);
vdo = vdo.replaceFirst(virg,link);
}else{
outRdf.newLine();
outRdf.write(protoLine);
} }
outRdf.newLine();
CharSequence csq = vdo;
outRdf.append(csq);
datRdf.close();
protoRdf.close();
outRdf.flush();
outRdf.close();
} catch(IOException e) {e.printStackTrace();}
}
}
class testChooser {
public static void main(String[] args) {
provaChooser fileRDF = new provaChooser();
fileRDF.complete();
}
}
cosa ho sbagliato?