scala> class Department( val departmentId: Int, val departmentName: String)
defined class Department
scala> javap -p Department
<console>:12: error: not found: value javap
javap -p Department
^
<console>:12: error: not found: value p
javap -p Department
^
答案 0 :(得分:1)
由于Scala REPL是不是 shell,因此您无法像在普通shell中那样调用javap
程序。
您可以使用内置命令:javap
:
scala> class Department( val departmentId: Int, val departmentName: String)
defined class Department
scala> :javap -p Department
Compiled from "<console>"
public class $line4.$read$$iw$$iw$Department {
private final int departmentId;
private final java.lang.String departmentName;
public int departmentId();
public java.lang.String departmentName();
public $line4.$read$$iw$$iw$Department(int, java.lang.String);
}
来自REPL :help
:
:javap <path|class>
反汇编文件或类名