In my application iam using some external libraries....
I want to build an executable jar file for my application....
I want the external jar files should also be present in the jar file....
I have tried, but failed to execute the jar file.....as my application unable to find the external jar files in classpath
I need help regarding...
Note:
--------
I have tried keeping the external library files outside the jar file and succeeded, but the requirement is different..
In this case i have come across one more problem, I have two java versions installed in my system Java 5 and 6.....Java 6 got installed because of some software
my application has some incompatibility issues with java 6 (especially with jdbc drivers)
while running jar file, it is giving some problem because of java version 6
Is there any way i can do some settings in jar file, so that the jar file run w.r.t jre version 5 instead of jre version 6
--------
thanks in advance
Abhishek
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32651
4
posted
0
Please give us full details of what you have in the manifest file.
Abhishek Reddy
Ranch Hand
Joined: Mar 28, 2006
Posts: 259
posted
0
thanks for the reply...
here is the manifest file description
----------------------------------------------------
---------------------------------------------------
I want even these external jar files to be accessed from within the sample.jar file
Also let me know, is there any way i can mention the JRE path in the jar file, so that the application will run with respect to specified JRE
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
Jar files can't be nested inside of other jar files if you want the JVM to load classes from them. You either need to distribute multiple jar files, or repackage all classes into a single jar file.
Also let me know, is there any way i can mention the JRE path in the jar file, so that the application will run with respect to specified JRE
That's not possible. You can use a BAT file to start your JAR file with a specific JRE, but think about what will happen if the user does not have that specific JRE, or has it installed at a different location.
One more query....Is there any way i can stop users from extracting contents from a jar file....something like password protected jar files or encrypted kind of thing...
I not how can i restrict users from decompiling the application class files..?
In short, it's not easy preventing users from unjarring a jar or decompiling your code (there may be some commercial products out there that I'm not aware of). Some people therefore use code obscuficators so that their code is not readable.
Certain types of Licensing also give you legal protection from people doing this.