Solved

CLASSPATH configuration

Posted on 1997-04-01
2
214 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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 functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

832 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