I created a program with java and scala mixed, but I am faced to an error while trying to call a java static method from scala.Here is the code:
object GestionBasesScala {
def sors_tout_de_suite() {
application.launcher.append("SCALA : exit")
}
}
the append method of the launcher class is like this (in java):
public static void append(String text) {
if (name_of_file != null && name_of_file != "") {
BufferedWriter bufWriter = null;
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(name_of_file, true);
bufWriter = new BufferedWriter(fileWriter);
// Ins�rer un saut de ligne
bufWriter.newLine();
bufWriter.write(text);
bufWriter.close();
} catch (IOException ex) {
// Logger.getLogger(TextFileWriter.class.getName()).log(Level.SEVERE,
// null, ex);
} finally {
try {
bufWriter.close();
fileWriter.close();
} catch (IOException ex) {
// Logger.getLogger(TextFileWriter.class.getName()).log(Level.SEVERE,
// null, ex);
}
}
}
}
I don't see what the error could be.
olivier
If you're using Scala IDE/Eclipse, sometimes the in-editor compiler does not pick when static methods become created and/or updated.
Running
"Clean..."
on the project makes the error go away.