Hai Friends,

i want read data from on ejar file to another jar file during runtime with out uisng network connections(like UDP, Tcp etc) and also with out creating external files, is there any way to read data?
please help me.

Recommended Answers

All 5 Replies

Use java.util.jar package classes. (java.util.jar.JarFile class)

In the "other" jar, provide a public class with public methods to access the data. As long as that jar is in the classpath you will be able to access the class and call the public methods from your first jar and thus access the data in a well-managed way.

In the "other" jar, provide a public class with public methods to access the data. As long as that jar is in the classpath you will be able to access the class and call the public methods from your first jar and thus access the data in a well-managed way.

how can i call jar1 class to jar2, is there any methods to call the particular data?

Wrong question! You can only call from a method in a class to another method in another class. Provided both classes are in jars that are in the classpath it will work. Look at the classes in jar2, see what public methods they have to access their data. If there aren't any you will have to write them.

ok , its working fine in creating file inside the jar

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.