[opencms-dev] Compiling Java Sub-Classes
Paul-Inge Flakstad
flakstad at npolar.no
Fri May 8 18:04:06 CEST 2009
Hi Frank
You could just create a Java class library, and export it as a .jar file using your IDE (Eclipse, from what I gather). If you don't know how to do this, you'll find tutorials on the web, just google a bit.
If you then upload the .jar file to your /system/modules/your.module.name/lib/ folder, you will have your classes available and ready to use. E.g. if you want to use them in a .jsp file, all you have to do is import them using the page import directive: <%@ page import="your.package.name.YourJavaClassName"%>.
It's strictly speaking not even neccessary to create your own module, you can just upload your .jar files to any /system/modules/****/lib folder - though I recommend you add them to your own modules.
The "drawback" of using .jars is that you'll have to restart Tomcat (and I assume you're using Tomcat) in order for your system to be aware that the .jar has been added or modified. (If you use .class files, I suppose you won't have to restart after adding or modifying your files - but I can't tell you anything about this approach, as I've only been using .jar files.)
Hope this helps.
Cheers,
Paul
________________________________
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Frank Pertack
Sent: 8. mai 2009 15:26
To: The OpenCms mailing list
Subject: [opencms-dev] Compiling Java Sub-Classes
Hello,
presently I am wasting a lot of time on trying to compile Java-Classes for OpenCms templates (according to the packt-publishing book "OpenCms 7 Development".
Unfortunately they only explain, how a Subclass is developed but there is not a word, how I can compile itand in which directory I have to copy it in the VFS. I adapted the suppied java-source-file of the Blog example since I changed the directory in which the index.html resides. But I don't know how to compile the java class inside eclipse and where to copy it. There are no ".class"-files in the "/system/com.deepthoughts.templates"-directory.
So please can anybody help me to solve this problem?
Thank you in advance
Frank Pertack
Vater Solution GmbH
Liebigstraße 26
24145 Kiel
Telefon: +49 431 20084-210
Telefax: +49 431 20084-222
Mobil: +49 151 16353519
mailto: fpertack at vater-gruppe.de
http://www.vater-gruppe.de
Amtsgericht Kiel, HRB 6403
Geschäftsführer:
Klaus-Hinrich Vater
Michael Wiese
-----
Diese Email enthält ggfs. vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese Email irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Email. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Email sind nicht gestattet.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20090508/2a7fe212/attachment.htm>
More information about the opencms-dev
mailing list