Java Classes


Recommended Posts

ok

we are creating a server from exsistiong code. I have the source or .java files and I also have .class files..

I need to use these methods in my program but I don't know how to add the methods.. they are part of package, but I also have the source file (.java) for each of these.. do I just put the source files in my same directory and what use import? or do I just call the class

example Server SImServer = null;

Link to post
Share on other sites

The .classes should be in a directory hierarchy the follows the package hierarchy (e.g. package foo.bar in foo/bar/). Add the root of the directory hierarchy to your classpath and import the classes as you normally would (e.g. import foo.bar.*). You don't need the source files unless you're modifying the code.

Edited by jcl
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...