Solved

CLASSPATH configuration

Posted on 1997-04-01
2
216 Views
Last Modified: 2013-11-23
I have an applet running on a Web server on the Sun,
and a browser running on a Windows NT PC.  

I want the Applet to find all the appropriate classes on the
server.  I know how to set a CLASSPATH on the client, but
I don't want the browser to look on the client.  I only want
to store the classes on the server.  

The Netscape browser will look in the html directory on the server.  However, I need to specify a path of different directories to search for classes.  Is there any way to set up a CLASSPATH on the SERVER that will be used?
If not, how do I get the Applet to look in the appropriate
places for classes?

0
Comment
Question by:gersho
2 Comments
 
LVL 2

Accepted Solution

by:
majkl earned 100 total points
ID: 1219368
There is no such way, because browser that download and interprets your classes look only in his classes. You cannot specify CLASSPATH for the server, because server treads java apllet classes files just like image or other.
So SOLUTION:
1.put all classes in same directory. Browser looks also for classes in that directory, from which main class came.

2. There is option which can you specify in <applet> tag.
Normal definition is <applet code="Test.class" WIDTH=300 HEIGHT=300></applet>
you can also use codebase ="javaclasses"  , which means that will  classes are stored in directory javaclasses.
so if dir hiearchy is
home-  (here are html documents)
     |
      -javaclasses (here are all java classes)

then he will also look in this dir else JVM wil throw ClassNotFoundException.
Hoep this helps
0
 

Author Comment

by:gersho
ID: 1219370
Clasess must be copied to same directory. As I said. Server doesn't know what kind of files it handels. It him same whether gif or class. He sends what browser wants. This depends on HTM protocol.  Httpd server just send, waht browser asks. You cannot specify where is the CLASSPATH to the web server :(

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 82
null output 3 35
maven module vs maven project 3 47
junit as external jar or library 7 23
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question