aspose file tools*
The moose likes JDBC and the fly likes Can I unzip class12.zip? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can I unzip class12.zip?" Watch "Can I unzip class12.zip?" New topic
Author

Can I unzip class12.zip?

Chris Ben
Ranch Hand

Joined: Jan 15, 2001
Posts: 135
I am not sure how to set the CLASSPATH in my UNIX account, so can I just unzip the class12.zip in my servlet directory?
Thanks for the help
Chris
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
If the zip file you are referring to just contains Java classes and associated resource files, sure. On the other hand, you may find that if your servlet container follows the Servlets 2.2 API or later, the you have access to a "lib" directory where you can put jars (and maybe zip files too) and they will be automatically picked up and used.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Bjarki Holm
Author
Ranch Hand

Joined: May 25, 2001
Posts: 65
Chris,
you shouldn't unzip the <code>classes12.zip</code> archive. Instead, set the class path according to where you store the file. For example, if you downloaded the file to <code>$JAVA_HOME/lib</code> (assuming the environment variable <code>$JAVA_HOME</code> is set, for example <code>/usr/java</code>), you set the class path with:
<code>export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes12.zip</code>
Hope this helps.
------------------
Bjarki Holm
Author of Professional Java Data
[This message has been edited by Bjarki Holm (edited June 10, 2001).]


Bjarki Holm
Chris Ben
Ranch Hand

Joined: Jan 15, 2001
Posts: 135
Hi Frank and Bjaki,
Thank you for your quick responses, I really appreciate it.
I believe my problem is as you suggested, I have no classes12.zip at the right directory.
My situation is a little awful. As a student, I am assigned a servlet directory to make my servlets work. However, I have no right to set up the server directly, for example, restart it.
That is the reason I put the unzipped class12.zip in my servlet directory in unix.
I hope I can manage it by myself so I do not have to talk with the people who set up the tomcat, who is not quite familiar with JDBC and Orcale.
It is really strange, after I put seemly unzipped class12.zip in my servlet directory, I have no problem to connect the oracle in the main method of my servlet, but I have the problem when i put it in the doGet(). Could you please explain waht is going on? I am confused.
Based on Bjarki's solution, I excute command in my UNIX account as
export CLASSPATH=$CLASSPATH:/home/chris/classes12.zip
based on my directory path. Then I rename the oracle directory previously in my servlet directory. I found it did not work.
Sorry for my unix 101 question, do you think I am on the right track to the solution?
In addition, I eventually can connect to oracle by write a stand alone DBServer program, in which main method, I open a socket and connect to the Oracle using the same codes in the servlet, then I contact this socket in doGet() in my servlet program, and I can work it out. BUT, this is an AWFUL solution and I need more coding and have the worse overall design. And it makes me more confused with the servlet, what is going behind it?
Too many questions, sorry about it.
Chris

Chris Ben
Ranch Hand

Joined: Jan 15, 2001
Posts: 135
BTW, is the class12.zip platform independent. I have my own which works fine in the NT system. Can I simply use it in the UNIX?
Thanks
Chris
Jason Kilgrow
Ranch Hand

Joined: May 21, 2001
Posts: 47
Unfortunately, in your case, I don't think you can have your servlet connect to the database without a server reboot. The reason why is because a servlet is an extension of the server. In this case, Tomcat (which I am intimately familiar with). Your servlet is actually extending the functionality of Tomcat. Therefore, whatever you want your servlet to do, Tomcat must know about it. If you want to add a library (classes12.zip), it must be place somewhere on Tomcat's classpath (preferably tomcat/lib) so it can see it and know about it. Then, when Tomcat restarts, it sees that classes12.zip is a library. Then your servlet should be able to use that library.
However, you could try to put classes12.zip in your project/lib directory. That may work. If tomcat is installed in /tomcat, and your project is installed in /tomcat/webapps/myproject, create a directory called /tomcat/webapps/myproject/lib and put classes12.zip in that directory. I'm thinking that might work.
If you are still having troubles and if you want to email me directly, we can work on this together.
jasonkilg@yahoo.com
Chris Ben
Ranch Hand

Joined: Jan 15, 2001
Posts: 135
Hi Jason,
Thank you for your help. Actually, the server deployed here is Orion. I believe that is a package for J2EE functions. And I do not have right to play with it except that I am in my own directory/~Chris/WEB-INF/...
In addition, if you are still interested in posting your suggestions, I hope you would not mind to post it under
FOR HELP: Failed to connect to oracle in servlet
I post two topics related to the same problems and I guess it could be better if seeing all the experts under one roof. And I just post one new post about the details of my problem.
Thanks a lot.
Chris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I unzip class12.zip?