Setting Env Variables durin installation using iZPack

Suppose My application uses an external jar like say a comm.jar. In that case while installing using the iZPack how can i set the class path in the environment variables during installing the application using iZPack.I need to set the class path as my application uses external jar file.I need to do it during installation using iZPack itself?  
paramu83Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
If you jar your application, you can simply include the depended-upon jar in the Class-Path manifest entry of your app's jar
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
Class-Path: other.jar
0
objectsCommented:
if you install then to the jre's ext directory then you won't need to change the classpath
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

CEHJCommented:
>>if you install then to the jre's ext directory

Personally i wouldn't disperse those files:

a. the user may not like your placing file in the ext directory - i wouldn't
b. it will break your application when a runtime upgrade occurs if you don't warn against this
0
paramu83Author Commented:
Can you show exactly how to do that?
just give the commands
0
Mayank SAssociate Director - Product EngineeringCommented:
When you JAR your application, it will create a manifest file inside the JAR file. Edit it in some editor like Notepad and write:

>> Class-Path: other.jar

- for all other JARs that you use in your project.
0
Mayank SAssociate Director - Product EngineeringCommented:
You can try placing the JARs in one folder and run them with java -Djava.lib.ext=<folder Path> yourApplicationClass too.
0
CEHJCommented:
>>java -Djava.lib.ext

I hope that isn't going to become a panacea now ;-)
0
Mayank SAssociate Director - Product EngineeringCommented:
Why?
0
Mayank SAssociate Director - Product EngineeringCommented:
Oh I just checked: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21793084.html

- is that the one you are referring to ;-) ?
0
CEHJCommented:
Yes ;-)
0
Mayank SAssociate Director - Product EngineeringCommented:
Oh, well.... :)
0
paramu83Author Commented:
I tried out by keeping app jar in one folder and the other jar in some other.
It is not working when i give the absolute path.
In that case how should i set the path.
Also If I make a change in the Manifest file it is making a duplicate copy of that outside the META-INF folder and showing errors.
0
paramu83Author Commented:
But in eclipse I can make the application refer to my Manifest file that I make rather than allowing it to make it self.
But it is not working with out eclipse.
0
paramu83Author Commented:
If I jar the second jar file with in the main app's jar using eclipse how should I set the path in that case. I tried giving the path as ClassPath: App.jar
It is not working.
How should I give the class path in this particular case??
0
objectsCommented:
> It is not working when i give the absolute path.

its needs to be a relative path

And you need to specify the location of your manifest when u create the jar
0
CEHJCommented:
You have to specify the manifest:

jar cvfm your.jar your.manifest X.class
0
objectsCommented:
> f I jar the second jar file with in the main app's jar using eclipse how should I set the path in that case. I

the jars need to be kept seperate, don't include the other jar inside your apps jar
0
CEHJCommented:
>> If I jar the second jar file with in the main app's jar using eclipse how should I set the path in that case.

You can't do that. You *can* merger the jars if you want using Ant so you have just one jar
0
CEHJCommented:
merger=merge
0
Mayank SAssociate Director - Product EngineeringCommented:
I would recommend keeping all JARs separate as they are so that they can also be used in other projects readily if required (like log4J, etc).
0
CEHJCommented:
>>so that they can also be used in other projects readily

Merging a jar inside another doesn't exhaust it ;-)
0
objectsCommented:
> I would recommend keeping all JARs separate as they are so that they can also be used in other projects readily if required (like log4J, etc).

absolutely, the only place I've even seen mention of jarring everything in one blob was here. Funny the things people suggest to try and get a few points ;)
0
CEHJCommented:
>>jarring everything in one blob

I do it frequently. It makes distribution and deployment (especially if you're not using an installer) a whole lot easier.

It would also make the current problem a lot easier to solve probably ;-)
0
paramu83Author Commented:
May I know Why the 2 jars should be kept seperate please?
0
objectsCommented:
> May I know Why the 2 jars should be kept seperate please?

cause you don't want to be redeploying *everything* whenevr you just change one class.
You want to deploy just the jar that has been updated.
And if you have mutliple apps you also don't want to deploy duplicate set of jars with every app.
It also make break some licensing rules.

Not to mention that it is unnecessary, jars are there so you can break your classes up and not have to include them in one big blob.
0
CEHJCommented:
Depends on the circumstances. It's often better in the long run with a small app to redistribute whole again - people tend to break things very easily. Having dependencies is a potential source of problems
0
CEHJCommented:
>>Having dependencies is a potential source of problems

... and of course it's the cause of your current problems, although we can get these fixed probably ;-)
0
objectsCommented:
its not the cause of the current problems, my comments above will resolve the problems u are having :)

0
Mayank SAssociate Director - Product EngineeringCommented:
So what's the status of the problem now? Has it worked?
0
paramu83Author Commented:
I have kept the jar files seperate. I could not edit the existing Manifest of the jar file. SO made a new manifest file and make the jar file use this manifest.

The problem is only giving the relative addressing. If they are in differnt drives how can i give the path?
0
CEHJCommented:
>>If they are in differnt drives how can i give the path?

You can't internally. You'll have to specify the cp *ex*ternally
0
Mayank SAssociate Director - Product EngineeringCommented:
Well, maybe try keeping them in a relative directory or the same directory as the application and then just specify the name of the JAR.
0
CEHJCommented:
If you're using an installer, you may as well use a batch file to start your app - it's more reliable than an executable jar anyway. You can put your jars wherever you want
0
objectsCommented:
why are they are different drives. Can't you injstall them all on the one drive?
0
objectsCommented:
> it's more reliable than an executable jar anyway

atually you'll find in real life that a batch is actually *less* reliable
0
CEHJCommented:
>>atually you'll find in real life that a batch is actually *less* reliable

Well i don't know any other life and i've found them *more* reliable ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.