473,396 Members | 1,866 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,396 software developers and data experts.

Where to deploy the jar/class file for calling a java class from ssjs

Hi,
I am using iplanet webserver 4.1. I want to call a java class from
ssjs file. But I am not getting the result. I have created a java class
file and put it in the folder <Server>\Netscape\Server4\bin\https\jar
folder. But I am not sure whether it is the right location to put the
class file. Also I would like to know how to put the class file in jar
format. The Java file and the ssjs file code given below.

Java part
package pdfbase;
import netscape.javascript.*;

public class Testcase {
public Testcase(){}

public int getValue()
{
return 1;
}

}

Javascript part
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<SERVER>
write('<HTML>');
write('<HEAD>');
write('<TITLE>Call 3 Java</TITLE>');

write('</HEAD>');
write('<BODY>');
write('<form name=form1>');
write('<h3>Javascript calling java</h3><br>');
var sObj = new Packages.pdfbase.Testcase();
var iVal = sObj.getValue();
write('<b>'+iVal+'</b>');
write('</form>');
write('</BODY>');
write('</HTML>');
</SERVER>

Jul 23 '05 #1
3 2643
Rajesh wrote:
I am using iplanet webserver 4.1. I want to call a java class from


http://jibbering.com/faq/#FAQ2_2

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2
David Dorward wrote:
Rajesh wrote:
I am using iplanet webserver 4.1. I want to call a java class from


http://jibbering.com/faq/#FAQ2_2


Read again. The OP wants to call a Java class from JavaScript which
is generally entirely possible and IMNSHO quite on-topic here since
the required features have been and still are part of the JavaScript
language. Look into Netscape LiveConnect for a start.
PointedEars
--
Die Amerikaner haben ihre Ausgaben zur Bekämpfung der Armut in der Welt
gerade auf 1,7 Milliarden Dollar reduziert. Das ist nicht einmal so viel,
wie sie in zwei Tagen fürs Militär ausgeben.
-- Eugen Drewermann, dt. Theologe, Februar 2003
Jul 23 '05 #3
Rajesh wrote:
I am using iplanet webserver 4.1. I want to call a java class from
ssjs file. But I am not getting the result. I have created a java class
file and put it in the folder <Server>\Netscape\Server4\bin\https\jar
folder. But I am not sure whether it is the right location to put the
class file.
Should be explained in the server documentation, but as the file is
currently not in JAR/ZIP format, most likely it is wrong in ...\jar.
Also I would like to know how to put the class file in jar format.
AFAIK .jar is but a ZIPped version containing the .class file.
Ask about this in a Java newsgroup.
The Java file and the ssjs file code given below.

Java part
package pdfbase;
import netscape.javascript.*;

public class Testcase {
public Testcase(){}

public int getValue()
{
return 1;
}

}

Javascript part
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
The proper DOCTYPE declaration for HTML 3.2 is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

HTML 3.2 is somewhat outdated (but not obsolete),
you should declare HTML 4.01 instead:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<SERVER>
write('<HTML>');
write('<HEAD>');
write('<TITLE>Call 3 Java</TITLE>');

write('</HEAD>');
write('<BODY>');
write('<form name=form1>');
write('<h3>Javascript calling java</h3><br>');
Up to here you don't need the write() method and the code needs
not to be enclosed in the SERVER element. It is static content.
var sObj = new Packages.pdfbase.Testcase();
Try outputting the string-converted value of `sObj' and use exception
handling. Former Netscape DevEdge content is currently temporarily
available at

<http://developer-test.mozilla.org/docs/Core_JavaScript_1.5_Guide:LiveConnect_Overview:Jav aScript_to_Java_Communication>
var iVal = sObj.getValue();
See above.
write('<b>'+iVal+'</b>');
Should always work if the above worked. If the script engine
is ECMAScript 3 compliant, you may want to change this to the
(here) slightly more efficient

write(['<b>', iVal, '</b>'].join(""));
write('</form>');
write('</BODY>');
write('</HTML>');
See above. Use the SERVER element only where it is required.
</SERVER>

HTH

PointedEars
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas A. Li | last post by:
I have a Java program which reads a text file when it is running. How to deploy it into the jar file I will deploy? The CLassLoader.GetSystemResource(String name) only search the class path and...
10
by: vwd2005eeb | last post by:
Visual Web Developer 2005 Express Edition Beta I did Build | Build Web site, where are the DLLs? I was expecting to see maybe one dll for each Web page in a directory (maybe still "bin") under...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
6
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
ASP.NET 2.0 / Visual Studio 2005 / VB.Net 2.0 I have a web interface that needs to launch a java application. What a long strange trip it has been... I am using Process.Start process start...
0
by: cong | last post by:
web.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app> <display-name>ShowLifecycles</display-name> <description>An example of how to use lifecycle events</ description> <listener>...
4
by: Dan | last post by:
Hi All, I've got a problem with my C++ application that calls a Java class that I've built with GCJ, I can't run it because I get errors: multiple definition of `atexit' first defined here...
3
raveendrabikkina
by: raveendrabikkina | last post by:
3087 / 3126 02/25 10:42:08 info Recovering 1 session(s) 3088 / 3126 02/25 10:42:08 warning Deployer Service failed to deploy file:/opt/jrun4/servers/cpbepost/logs/ 3089 / 3126...
1
oll3i
by: oll3i | last post by:
I created ejb project in eclipse added application.xml to meta-inf folder exported the ear but when i try to deploy the ear in sun java system app server admin console it says that there is no...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.