Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

importing and using .class file

Thread view: 
Raous - 12 Jan 2006 00:00 GMT
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/)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.