Issue with "javap -p"


#1

Hello,

I am having difficulty using the “javap -p” command with classes.

For example, when I used the command on my class nameAgeAdress (javap -p nameAgeAddress), I receive the following error:

scala> javap -p nameAgeAddress
:12: error: not found: value javap
javap -p nameAgeAddress
^
:12: error: not found: value p
javap -p nameAgeAddress

Furthermore, I am unable to access individual parameters of the class also like nameAgeAddress.name.

Can you offer any help on this issue please?

Thank you!

Patrick


#2

@PatrickO_Rourke,
Have to use :javap not javap


#3

Hello Sravan,

Thank you for your reply.

That solved the first issue with regards using the javap on the class.

But, I still cannot access or change individual parameters of the class.

For example, say I wish to change the “name” parameter of the class nameAgeAddress to 3 (val nameAgeAddress.name = 3), I receive the following:

:11: error: not found: value nameAgeAddress
val nameAgeAddress.name = 3

What is this issue?


#4

@PatrickO_Rourke,
Please share the code once for better understanding.


#5

Hello,

The code is the following:

scala> class nameAgeAddress(name:String, age: Int, address: String){
| println(“My name is”+name+",my age is" + age+ “and my address is” + address)
| }
defined class nameAgeAddress
scala> val b = nameAgeAddress(“Hi”,2,“Bye”)
:11: error: not found: value nameAgeAddress
val b = nameAgeAddress(“Hi”,2,“Bye”)
^
scala> val b = new nameAgeAddress(“Hi”,2,“Bye”)
My name isHi,my age is2and my address isBye
b: nameAgeAddress = nameAgeAddress@3ac42916
scala> javap -p nameAgeAddress
:12: error: not found: value javap
javap -p nameAgeAddress
^
:12: error: not found: value p
javap -p nameAgeAddress
^
scala> :javap -p nameAgeAddress
Compiled from “”
public class nameAgeAddress {
public nameAgeAddress(java.lang.String, int, java.lang.String);
}