I tried to create a simple Kotlin command line app
import java.RegistroJ
class Main
fun main(){
var registro:RegistroJ? = RegistroJ()
registro?.setCognome("Baudo")
registro?.setNome("Pippo")
var registro2:RegistroJ = RegistroJ()
registro?.setNext(registro2)
registro2.setCognome("Ballo")
registro2.setNome("Pluto")
var registro3:RegistroJ? = RegistroJ()
registro2.setNext(registro3)
registro3?.setCognome("LOL")
registro3?.setNome("ABC")
while(registro != null){
println("Hello " + registro.getNome() + " " + registro.getCognome())
registro = registro.getNext()
}
}
and a really easy Java class
package java;
public class RegistroJ {
private String cognome;
private String nome;
private RegistroJ next;
public String getCognome() {
return cognome;
}
public void setCognome(String cognome) {
this.cognome = cognome;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public RegistroJ getNext() {
return next;
}
public void setNext(RegistroJ next) {
this.next = next;
}
}
But when I try to compile everything inside Eclipse I get no error but my kotlin .class are not updated. I have a kotlin equivalent of that class and with that everything works. But I want to be able to integrate my java class to kotlin If I try to compile from command line I get:
Main.kt:1:13: error: unresolved reference: RegistroJ
How can I solve this problem?