Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java : javap ERROR:Could not find .class

Tags:

java

javap

In my system(Ubuntu 10.04) java is running fine but I am not able to run javap command
I have complile Foo class and .class file path is locate at
/home/mahesh/java/opt
when I execute
javap -c Foo.class
I get following error message :
ERROR:Could not find Foo.class
Is there any need to set any environment variable or any thing else to resolve it. my $PATH variable is target to:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/bin/
Thank you.

like image 570
mcacorner Avatar asked Nov 13 '12 07:11

mcacorner


People also ask

What is Javap command in Java?

The javap command disassembles one or more class files. Its output depends on the options used. If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it. javap prints its output to stdout.

How do I view a .class file?

A simple way to see what String literals are used in a ". class" file is to use the javap utility in your JDK installation to dump the file using the "-v" option. Then grep for text that looks like <String "..."> where ... is the String you are looking for.

Why is Javap used?

The javap tool is used to get the information of any class or interface. The javap command (also known as the Java Disassembler) disassembles one or more class files. Its output depends on the options used (“-c” or “-verbose” for byte code and byte code along with innards info, respectively).


1 Answers

You just need to remove the .class extension.

Use the following command: javap -c Foo

like image 58
mkhelif Avatar answered Oct 10 '22 20:10

mkhelif