Shared class in java.

Thread Solved

Join Date: Jun 2008
Posts: 46
Reputation: zyaday is an unknown quantity at this point 
Solved Threads: 1
zyaday zyaday is offline Offline
Light Poster

Shared class in java.

 
0
  #1
Apr 29th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 2,094
Reputation: javaAddict is a splendid one to behold javaAddict is a splendid one to behold javaAddict is a splendid one to behold javaAddict is a splendid one to behold javaAddict is a splendid one to behold javaAddict is a splendid one to behold 
Solved Threads: 264
Featured Poster
javaAddict's Avatar
javaAddict javaAddict is offline Offline
Postaholic

Re: Shared class in java.

 
0
  #2
Apr 29th, 2009
Create a seperate Project with some classes and then you can import these classes like you import any other class:

  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.
I murdered thousands for the Emperor and he gave me nothing except his damning silence. Now his lapdogs yap for every life I take, while the gods promise me the galaxy.
- Svane Vulfbad -
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 46
Reputation: zyaday is an unknown quantity at this point 
Solved Threads: 1
zyaday zyaday is offline Offline
Light Poster

Re: Shared class in java.

 
0
  #3
Apr 29th, 2009
thanks lots i will try that...
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 3,906
Reputation: adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future adatapost has a brilliant future 
Solved Threads: 702
Moderator
adatapost adatapost is offline Offline
Senior Poster

Re: Shared class in java.

 
0
  #4
Apr 29th, 2009
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.).
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 540 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC