• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can I unzip class12.zip?

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Chris Ben
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic