This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes A problem about jar .... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "A problem about jar ...." Watch "A problem about jar ...." New topic

A problem about jar ....

jhun kam

Joined: Dec 05, 2001
Posts: 18
I'm not sure where my problem fits, but because it's related to EJB, i post it here .
Here is the situation :
I want to apply for a job. The company requires the applicants to create an EJB application implementing an interface given by the company. From my application, i will get the home object, create the ejb object, and pass my data by calling the corresponding method.
Then, i need to jar them all(classes, my CV) and upload the jar-bundle to them, via their upload-servlet@their web page. My app will get executed there, and the if any runtime errors occur, they'll get printed on my browser.
Here's my problem :
One of the required method in my class was meant to read my CV which is in word-format.
jobApplication.setCurriculumVitae(byte[] buff);
The buff represents my CV.doc binary. Here comes the problem. How do i read my data from a file which is inside a jar file ?
I've tried several ways. I've tried out the plain FileInputStream which results in FileNotFoundException. I've tried out ClassLoader.getSystemResourceAsStream("CV.doc"), and it apparently returns null. Please help.
Vels Manian

Joined: Jun 28, 2001
Posts: 22
You have to use JarInputStream for this. Follow the steps and u can easily read the file..
1) Create a JarInputStream for the jar file..
2) Get the ZipEntry from the stream and check for ur CV.doc.
3) Create a ZipFile and get the InputStream for the file by passing the ZipEntry to the getInputStream().
Hope u can proceed after this..
Best wishes.. lemme know if u get the job..
jhun kam

Joined: Dec 05, 2001
Posts: 18
Thanks for the idea, i'm still trying here ... I'll let you know my progress.
I agree. Here's the link:
subject: A problem about jar ....
Similar Threads
Getting existing data with CMP
How to get the (cookie) Session Id into my JNLP
Hard to configurate Hibernate using NetBeans 5.5.1
long post IBM.158
HTTP Status 405 - HTTP method GET is not supported by this URL