473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Using dll and .conf files in java web application

Hi all,

I am using netbeans as IDE and glassfish as app server for my web application.
At runtime it needs some dll files and .conf file. Now the question is:
1. How should I package the .conf file into my web application war file. The scenario is that one .conf file makes use of another. e.g. if one file is a.conf and another is b.conf then the path of b.con is specified in a.conf as absolute path. How I have to change this path in case I will bundle it in my war file.
2. How can i configure app server or netbeans so that the dll files will be available at runtime to the application.

This is really urgent as I am stuck on it.

Thanks
Gaurav
Apr 6 '09 #1
3 5705
chaarmann
785 Expert 512MB
1.) don't hardcode any absolute path! You can always get the current directory where your application started. In your case you can get the directory where you deployed the war-file with
Expand|Select|Wrap|Line Numbers
  1. servletContext.getRealPath("/").
If you use relative path only then referencing to one file inside another is no problem. For example I use an entry in web.xml to reference to an .xsl file I need for transformation:
Expand|Select|Wrap|Line Numbers
  1.     ServletContext servletContext = request.getSession().getServletContext();
  2.     String xslFile= servletContext.getInitParameter("xslFile"); // e.g. "/xslFiles/myFile.xsl"
  3.     String xslFilePath = servletContext.getRealPath(xslFile) ; // e.g. "C:/Tomcat/webapps/ROOT/myApp/WEB-INF/xslFiles/myFile.xsl
2.) don't use *.dll files. Just get the corresponding *.jar file. Dll-files are platform dependent and only run on Microsoft Windows. If you access functions in dll-files through native calls in java (or whatever you do with the dll-files, I am really wondering about that), you need to provide the corresponding files for EVERY platform. For example corresponding *.so files for Linux, Mac-OS, AIX, HP-UX, Solaris and others. For each of these platforms, you need to provide your own platform-dependent installer. (For example InstallShield on Windows that copies your dll-files into the win32-directory). That's a lot of work and possibly not a good idea, so avoid *.dlls and use *.jar files instead, which can be easily deployed, no matter what operating system you are using. (Just put them into lib-directory or add them to your classpath)
Apr 7 '09 #2
Hi chaarmann,

Thanks for the reply.

Suppose I put my A.conf file under WEB-INF/classes/config folder which refers to B.conf file in the same folder should I change the path to B.conf as /config/B.conf.

Regarding dll files, these are some tool specific files that needs to be used and these are to be used only on Windows platform so can you please tell me where should I put it in my web application so that these are available to my application at runtime.

Thanks
Gaurav
Apr 7 '09 #3
chaarmann
785 Expert 512MB
@gjain123
That could work. But most likely it's "classes/config/B.conf". (see comments in my code example above).
To make sure just print out the path you get (system.out.println(servletContext.getRealPath("/")), it should be "WEB-INF/classes" in your case, then you know what to append to it.

@gjain123
See above, I already suggested to use something like InstallShield, so users can easily deinstall.
But if it's only for yourself, just copy the dlls into the directory "system32" inside your windows-directory, where all the other dlls are.
Apr 7 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Phil Powell | last post by:
In /etc/httpd/conf.d/php.conf there is a line that limits the size of $_REQUEST to a byte size that, when shipped with PHP, comes to approx 524K, however, that amount can be changed. How can you...
0
by: mdh | last post by:
I am trying to learn the basics of MVC applications using a Tomcat infrastructure. I'm starting by building a simple application with: * a login.jsp page for a basic login form with a action...
1
by: Oliver Hoehle | last post by:
Hello! I tried to get my J2EE app working with DB2 for several days and now it seems to work, but... (Tomcat 5.0.19 on NT 4.0 with J2SDK 1.4.1_02) 1) Declaring the DB2-datasource in...
0
by: atlantis | last post by:
Hi, I have a very strange problem with xsl:import when usig RELATIVE path on AIX 5.2 server. I have two XSL files in the same directory: "ists_xslt3.xsl" and "ists_xslt3_layout.xsl". This...
1
by: brahatha | last post by:
I am trying to come up with a Java code where I can read a xml file and extract particular element/attribute. This is the structure of xml I have <RootElement> <colAttempt> <Attempt1 a="1"...
8
by: ajos | last post by:
hi frnds, im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception. to verify this error ive...
5
by: bmm | last post by:
I have a Store Procedure on a Sql Server 2000 Where I use the Table Hint "NoLock" on all selects. One of my clients (OleDbConnection from C#) doesn't get the same Result Set as the others. The...
0
by: choukse | last post by:
Hi All, I am trying to bind to ADAM instance with a windows user through JNDI and it keeps failing. My ADAM and AD is running on same Windows 2k3 server. But, through LDP I am able to bind with...
0
by: =?Utf-8?B?QWxleA==?= | last post by:
Hi to everyone At the moment, I am converting a .Net 1.1 application to 2.0. As the My.settings did not exist in the 1.1 framework, the "101 VB.NET Sample" "How to configuration settings" was...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.