943,549 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 1027
  • Java RSS
Apr 29th, 2009
0

Shared class in java.

Expand Post »
I have many projects in a software. Although some files and classes are shared within these projects, there are classes used by most of these projects. How do i creat classes that can be shaed among different projects . Is there anything in java that can function the same as 'modules' in vb.net?
Thanks a lot.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
zyaday is offline Offline
70 posts
since Jun 2008
Apr 29th, 2009
0

Re: Shared class in java.

Create a seperate Project with some classes and then you can import these classes like you import any other class:

Java Syntax (Toggle Plain Text)
  1. import java.util.*

The only difference is that you will be importing your classes with their packages.
You can take the .class files (in their folder/package) or create a jar file with the classes. Then add that to the classpath of the project you want them to be used.
Sponsor
Featured Poster
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
javaAddict is offline Offline
3,258 posts
since Dec 2007
Apr 29th, 2009
0

Re: Shared class in java.

thanks lots i will try that...
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
zyaday is offline Offline
70 posts
since Jun 2008
Apr 29th, 2009
0

Re: Shared class in java.

Dear,

Create .jar of those classes you want to use them in different projects and append the entry of .jar file CLASSPATH environment variable.

PS:
You can place .jar files in \jdk1.6.0\jre\lib\ext . (shared folder of jvm - am I?, Mr. Ancient Dragon.).
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Java Help
Next Thread in Java Forum Timeline: hey everybody,m an it student from india,n I'm in great trouble.Pls help!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC