Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to add file to a Jar file (via Java code)

795658Aug 6 2009 — edited Aug 8 2009
Hi,

I need to to insert a text file into a jar file (via my Java code). Can you try to think of a way to do so?

Thanks,
Uri

Comments

843833
I'm wondering if there will be an update of the tutorial, it would be really helpful.
I got the example working, you just have to build it with ant.
Deploy it with the deployTool,leaving the deployment setting filename blanc and generate the stub by selecting the deployed application.
When running with runclient you have to specify this stub and than it seems to work fine.

Regards
843833
Looks like the structure of the J2EE ver1.3 and 1.4 is different.
Using the deploytool will ease a lot rather than using the command-line ANT. Sun people, please WHY there is no JNDI names tab in the deploytool? as well as the security option tab. Do clarify on this matter.
843833
Hi,

How do you generate the stub ??

Thx in advance,
Nicolas G.
843833
hi all,

Is their a solution to set up de platform-specific deployment file in the deploytool of j2sdkee 1.4 ??
The deployment failed at each time for the moment.

thx a lot,
Nicolas G.
843833
The JNDI tab is missing in the deploytool and i guess this should be a bug in the same. SUN do rectify it at the earliest.
843833
There is actually no bug in the 1.4 version
You have to first create the EJB jar and the Client jar etc as usual then you will have to select
{"File"|"Deployment Settings"|"Create New File"}

it will present a default file name, accept that or give an xml file name of your choice. You have just created the deployment descriptor. Now go back to the application tree and you will see a node called "Sun's J2ee Reference Implementation". This node will appear under all your existing branches. Click on this node under your EJB branch. Now you can see the JNDI name tab. Enter the JNDI name here and in your client application

It should work

Joy
843833
One tip to solve a "beginner's trouble" that I had.
Trying the sample "cmpcustomer" I didn't know precisely how to set the jndi names, the link to cloudscape and so on.

I extracted the file "sun-j2ee-ri.xml" (the one that in the previous version was used to provide deploying data) from the ear and used it to fill the information as suggested in the previous post.

It worked!
Hope to have been useful

Carlo
843833
i have been trying to fix this j2ee1.4 jndi tab problem for about 7 days now..
i was really feeling frustrated i must confess. i am going to try it out now with the hope it will work.
and if i may ask, must i always specify the client jar file first before performing these actions to get the deploy tool?

hoping to hear from you soon.
thanx
-Ebi
843833
hi folks,
i've resolved the jndi tab problem and finally deployed the ConverterApp app.
but when i try to run the ConverterClient from the command prompt, it always throws an exception like Unsupported Exception.
Can anyone tell me how to get around this.
thanx
-ebiere
843833

did you try runcleint.bat ?
843833
You said you resolved the JNDI Tab problem, could you please explain how you managed this. This is my current road-block in getting the Converter example going.

Thanks.
843833
You might want to try using J2EE Tools. It works with the examples in the J2EE Tutorial using J2EE Version 1.3.1 and the J2EE Tutorial Addendum using J2EE Version 1.4. The steps for using both are described in detail. You'll find it at

http://groups.msn.com/J2EETools
843833
Thanx for the info, it helped me out a lot !

But I dont really understand what is going on, why do you have to create {"File"|"Deployment Settings"|"Create New File"} ??

Raymond
1 - 13
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 5 2009
Added on Aug 6 2009
8 comments
295 views