I have a .class file, not a .java file.
After I imported it to my Eclipse Project,
I had no idea to use it.
I put
import foo;
but eclipse doesn't recognize 'foo' as a class name.
How can I use a .class file?
Do I need its source file?
Michael Redlich - 12 Jan 2006 01:53 GMT
> I have a .class file, not a .java file.
>
[quoted text clipped - 9 lines]
> How can I use a .class file?
> Do I need its source file?
Hi Raous:
foo.class is the resulting bytecode from successful compiling foo.java.
You need a Java Virtual Machine (JVM) to execute foo.class. For
example:
C:\> javac foo.java
will generate foo.class assuming that everything successfully compiles.
C:\> java foo
will invoke the JVM to execute the application.
With Eclipse, you can execute your own source code from within the IDE.
If you don't have the source code, you might be able to decompile it.
Just do a Google search on "Java decompilers" to find out more...
Hope this helps...
Mike.
--- ACGNJ Java Users Group (http://www.javasig.org/)