Update: Below problem is remained until Android Studio 3.4.2
.
I use Android Studio 3.3
and created a scratch
file (File > new > Scratch File > Java
). The IDE created scratch.java
in ~/.AndroidStudio3.3/config/scratches
:
class Scratch {
public static void main(String[] args) {
}
}
But when I run that scratch file ( by pressing green button near to the class name or main
method), I get this error:
Error: Could not find or load main class Scratch
I think that IDE does not make Scratch.class
and so Java
cannot find it. Is there a way for solving this problem and running scratch files from IDE (without using Terminal
)?