Applet talking to Servlet - Please help!!!

Hi,
Below is the code for a very simple servlet. After that is the code for an applet that sends a query to the servelt. After that is the .html file that invoques the applet. At the bottom is my directory structure and the location of my files. This is what happens:
1. When I type in the browser: "http://localhost:8080/servlet/myApp/TestingServlet", two things happen:
a) I get the html greeting "Welcome to ..." on the browser.
b) The tomcat console displays "Hello from TestingServlet...".
2. When I type in the browser: "http://localhost:8080/myApp/TestApp.html", I expect to see the message in the tomcat window as in b) above; but nothing is displayed there. Apparently the applet doesn't find the servlet.
I hope you can point to me what I'm doing wrong.
Thanks,
Miguel
// this is the servlet code: TestingServlet.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class TestingServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
System.out.println("Hello form TestingServlet...");
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Servlet Testing</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("Welcome to the Servlet Testing Center");
out.println("</BODY>");
out.println("</HTML>");
// here is the applet: TestApp.java
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
import java.util.*;
public class TestApp extends JApplet {
public void init() {
String inline = "http://localhost:8080/servlet/myApp/TestingServlet";
debWindow.prnt("Request: " + inline);
try {
URL url = new URL(inline);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
} catch (IOException ex) {
// this is the TestApp.html file
<HTML> <HEAD>
<TITLE>Test/TITLE></HEAD>
<BODY>
<APPLET CODE="TestApp.class"
WIDTH = 500 HEIGHT = 400 MYSCRIPT>
</APPLET></BODY></HTML>
My directory structure is as follows (all in one computer):
tomcat
webapps
myApp
WEB-INF
classes
myApp contains TestApp.class and TestApp.html
classes contains TestingServlet.class

This bit:
} catch (IOException ex) {
}Insures that you will never see any helpful exception messages. Change it to
} catch (IOException ex) {
    System.out.println("Error: " + ex.toSting());
}Or some such and then look at your Java console and see what it says. My guess is you are getting a security exception at or around the openConnection call.
Good luck
Lee

Similar Messages

  • I have an iphone 4, need to get to cellular network data, it will only go as far as cellular on the phone, I have straight talk service. Please help! I cannot send or receive pics!

    I have an iphone 4, need to get to cellular network data, it will only go as far as cellular on the phone, I have straight talk service. Please help! I cannot send or receive pics!

    Is there any chance that you must have it in the package of your provider as an option?

  • Error in JDBC while using in a Servlet.Please HeLP!!!!!!!

    &#304;s there any one can help me I will be very glad.
    I'm preparing a homework for University and have a small(for me B&#304;&#304;G) problem.
    I want to make a database connection with servlet .
    as a full working program I try to use CONNECT.java To Run in a Servlet.
    My program can run on eclipse platform with out any problem but when I want to use it in my server with servlet (I change the program as a servlet) I take This error What Sould I dou.
    PLEASE Help.....
    MY ERRoR is:
    java.lang.ClassNotFoundExeption: com.microsoft.jdbc.sqlserver.SQLserverDriver
    It works on Ecl&#304;pse but Not in my server with servlet
    HELP HELP HELP....

    You don't have the JDBC-SQLServer driver in the classpath when you run it on the server. (You probably added the driver into the Eclipse project library.)
    Depending on how you set up your server and java container, you might try putting the driver in the "WEB-INF/lib" directory (if it's a .jar file).

  • Problem with Accessing Deployed Servlets Please help, very urgent.

    Inspite of going through lots of Docs. I am not able to access the JSP which is deployed using JDeveloper 3.2 in the browser? What should be the URL and where should I place the JSP and the related files in the Apache Server (Specific directory)?
    Please help, this is very Urgent.
    Could I get some sites where I can get detailed description of how to deploy and access Servlets and JSPS using JDeveloper 3.2 for OAS 9i?
    Thanks in advance,
    Regards,
    Kavita.
    null

    Hi Kativa,
    In answer to your first question: In most apache installs, you want to place all your JSPs under the Apache/htdocs directory. This htdocs directory becomes the root directory of your HTTP request, so, for example, to access the file
    Apache/htdocs/mydir/myJSP.jsp
    you'd point your browser to
    server:port/mydir/myJSP.jsp]http://server:port/mydir/myJSP.jsp
    As to your second question: Do you mean Oracle 9iAS? If so, look at this HOWTO: http://technet.oracle.com:89/ubb/Forum2/HTML/006398.html
    JDeveloper 3.2 does not support deployment to OAS (the predecessor to iAS), but there was no OAS 9i.
    null

  • Want to run the servlet (please help me)

    Hello Guys, I'm very new to java, I have downloaded the tomcat's servlets runner, and could able to write servlets and then could able to compile them without any errors, but the major problem is I'm not at all able to run them, first of all I dont know where shall I put the comiled servlet.class files, and I'm starting the Tomcats http server, and it is not picking up my servlets, could u please specify in whcih directory should I place my compiled servlets,
    with regards,
    shabeer.

    Hello Ajit, well I have read all the documentation and I have run all the example servlets in Tomcat, but the problem is my oracle server is listening at 8080 port so I have given a different port number(2002) to tomcat while installation, im using(http://localhost:2002/examples/servlet/MyFirstServlet) and I have placed my compiled servlet in the classes file and trying to access it, Tomcats HTTP server is recognising the servlet but it is giving some exception, I think it is saying something about configuration, do I need to make any changes in the server.xml file please advice me...here is the error what it says on the browser servlet exception....
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/MyFirstServlet
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:427)
         at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:471)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class MyFirstServlet with modifiers ""
         at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
         at java.lang.Class.newInstance0(Class.java:300)
         at java.lang.Class.newInstance(Class.java:259)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:892)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:408)
         at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:471)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:536)
    Apache Tomcat/4.1.12
    please help me

  • Applet won't load, please help!

    Using the java for chat hasn't been an issue until recently, for one chat site and one alone, the java won't load. I've been on the website FAQ and i've read the causes and solutions but they don't make sense to me. In the internet options the box i have checked and have always had checked is automatically detect settings, i'm a little confused as to why it isn't working.
    In the java console i get this message :
    load: class com.diginet.digichat.client.DigiChatApplet not found.
    java.lang.ClassNotFoundException: com.diginet.digichat.client.DigiChatApplet
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    Any help or suggestions would be greatly appreciated.
    Thank you
    Lola

    Thank you so much for replying so quickly, i have emptied my temp files and delete cookies etc. i'm still having issues. Where will i find the browser settings to allow java applets and if they are working on other rooms, wouldn't that mean that its set to allow them? As u can tell i'm not computer literate at all.
    Please help!
    Thank you so much
    Lola
    x

  • Converting application to applet.... please Help

    This program shown works fine in appletveiwer however will not work with I.E. nor Netscape. I do have the java plugins for both and using a netscape version over 6.0. I made the program usint jdk1.3. Can anyone please help me out?
    java code
    // TabbedPaneFlags.java: Use tabbed pane to select figures
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TabbedPaneFlags extends javax.swing.JApplet
    // Create a tabbed pane to hold figure panels
    private JTabbedPane jtpFigures = new JTabbedPane();
    // Load Images
    private JLabel lblUSA = new JLabel(new ImageIcon("USA.gif"));
    private JLabel lblUK = new JLabel(new ImageIcon("uk.gif"));
    private JLabel lblGER = new JLabel(new ImageIcon("germany.gif"));
    private JLabel lblCAN = new JLabel(new ImageIcon("canada.gif"));
    private JLabel lblCHI = new JLabel(new ImageIcon("china.gif"));
    private JLabel lblIND = new JLabel(new ImageIcon("india.gif"));
    // Main method
    //public static void main(String[] args)
    // TabbedPaneFlags frame = new TabbedPaneFlags();
    // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // frame.setSize(450, 350);
    // frame.setVisible(true);
    // Constructor
    // public TabbedPaneFlags()
    public void init()
    // setTitle("Tabbed Pane Demo");
    jtpFigures.add(lblUSA,"USA");
    jtpFigures.add(lblUK,"UK");
    jtpFigures.add(lblGER,"Germany");
    jtpFigures.add(lblCAN,"Canada");
    jtpFigures.add(lblCHI,"China");
    jtpFigures.add(lblIND,"India");
    // Place tabbed pane
    this.getContentPane().add(jtpFigures, BorderLayout.CENTER);
    html code
    <html>
    <head>
    <title>AppletMenuDemo</title>
    </head>
    <body>
    <applet
    code = "TabbedPaneFlags.class"
    width = 450
    height = 350
    alt="You must have a JDK 1.2-enabled browser to view the applet">
    </applet>
    </body>
    </html>

    You should try the html converter so that the browsers are forced to invoke their plugin... or prompt the user to download one.
    To turn an applet into an application is easy. You act like the browser. You make a frame, construct the applet, and put the applet in the frame, (They are components) ... Then just call the init() method. Then add a window listener to call the stop() method when the frame gets closed.
    Application to an applet is a bit harder. You need to figure out what needs to be in the init method. Depending on what the application does you can also run into security issues.

  • JSP - Servlet - Please help

    Hi:
    Can any one suggest me the code for the following scenerio, Am new to jsp-Servlet....
    I need to give an EMPNAME in a Textbox on clicking GO button from my JSP page, a servlet must process thei query and display the output of that employee details back to that JSP page..
    Please help me out with some code snippets...
    Regards,

    The sun's site provides a detailed introduction to JDBC. or
    have to google for JDBC and once you've understood the JDBC concept, then you could progress from there. There is no simple way of doing what you asked.
    You will need a database, though you could use MS Access. But you still need the JDBC.

  • Send an email for an Applet....please help ..

    hello guys...
    i have an applet that works much like an HTML form...
    it is a form for products and after having filled that the information has to be updated to the database and the concern people of the company should get an email for the same ....
    how can i send that mail from this Applet... !?!?
    hope someone has some idea about it.. !!!
    please help..

    You should be able to use JavaMail from an applet. The general outline would be the same as from a stand-alone application. However make sure you read the notes (found in %JAVAMAIL_HOME%/NOTES.txt once you install JavaMail) to know about some issues associated with using JavaMail from applets running certain browsers.

  • Drawing in Applet ??? Please help

    Hi
    Im trying to create a class Component that draws in
    a applet without passing the applet Graphics into the
    class Component.
    I have read same posts but didnt find nothing, only
    public void paint(Graphics g) {
    super.paint(g);
    or
    classComponent.paint(g);
    There most be a way of drawing in the applets without doing
    this, like the Buttons (and more) only do -
    Button b = new Button("MyButton");
    b.setBounds(10,10,100,100);
    this.add(b);
    and the button is draw in the applet without passing
    the applet Graphics.
    Please help.
    Thanks

    When the applet is painted, it paints each of the Components that you have added by calling the components paint() method and passing the component a Graphics. You need a Graphics if you want to do your own drawing.

  • I forgot my security questions' answers and Apple Support won't talk to me please help!!!!!

    Please help!!

    How have you been contacting them ?
    If you have a rescue email address (which is not the same thing as an alternate email address) on your account then you can reset them yourself : http://support.apple.com/kb/HT6170
    If you don't have a rescue email address then you will have to contact Support in your country to get the questions reset : http://support.apple.com/kb/HT5699 - is the number/link for your country on that page how you've been contacting them ?

  • New with Servlets - please help

    Hello:
    I am using JDev to work with JSPs/Servlets .Can someone please direct me how to setup JDev to work with JSPs and Servlets.
    Question 1: I downloaded JDev Full Version which said that it included JDK1.5 . But I don't know where it installed it. I just unzip the folder. Do I have to install JDK differently?
    Q2: Using Tomcat Application Server - it asked to locate the folder where JRE is installed . Where can I get that info.
    Q3 : How to setup Servlets so that I can load a servlet file in the browser. I created a "Hello World" app using Servlets but I can't load it .
    I will appreciate you help.
    THanks

    user517625,
    First, for your information, Tomcat is a servlet container, not an application server. Second, Oracle JDeveloper includes an [embedded] application server: OC4J. So you don't really need Tomcat if you only want to create and test some servlets and JSPs. JDeveloper includes extensive "help" information and sample code that shows you how to create servlets and JSPs.
    Good Luck,
    Avi.

  • Synchronized problem in JSP/Servlet, please help me.

    Hi, all
    I have many processes in one JSP page or Servlet program of my project.
    When many people visit at one time, then the project throws some SQL/DB Errors.
    I have updated it and test it many times, I think, that is a synchronized problem.
    At last I used ��synchronized (this){my JSP/Servlt SQL/DB processes}�� to synchronize
    The process. Then the errors removed.
    And now I think that too danger to use the ��synchronized (this){}�� to synchronized.
    If use it then some other problem may be growling on. Such as when one people need to use
    This service others must to wait, the process may be too slow! And when an exception throws
    from the SQL/DB or some other place, what I do? Need any advice from you.
    Sincerely
    Urey
    *** my JSP/Servlt Server is tomcat ***

    As Chuck points out, there isn't a new instance of the Servlet/JSP for each request - they are probably all calling the same instance so any state will be shared. If your Connection is stored as a member variable then you'll have problems with it already being in use if two people hit the page at the same time.
    Limited resources such as database connections should ideally be pooled anyway to ensure that you're not opening them all the time and that you can control how many are open across the entire application. Then you'd simply need to get a fresh connection out of the pool at the top of the page and make sure you put it back when you're done.
    Incidentally, although it might work, synchronizing the database access in the JSP would be a bad idea since you'd just create a queue of requests waiting to use the one Connection whereas you really need a number of Connections to deal with everyone simultaneously.
    If you need some example code for a simple JSP using a database connection pool (DataSource) just say.
    Hope this helps.

  • Can't get java to initiate applet, or even run, please help

    I need help, please. Need java to do some organic chem work, and I can't get it to work. I have Java 2 runtime SE - 1.4.1_05, virtual machine 1.4.1_05-b01, and plug-in the same as J2SE. The Web Start file was corrupted when it downloaded, so I removed it from the Add/Remove in control panel. I'm running windows 2000 Pro, I'm not a computer expert (means I need explicit instructions), I'm a vet student trying to do my homework, and study for exams. Any reply here will be very appreciated, or to my e mail [email protected] Thank you, Cindy

    There are plenty of people here that can and will help, but you need to tell us what the problem is (details, error messages, code samples, etc)
    Here's a general blurb, post back it it doesn't help.
    This may duplicate some of what you've already done, if so fine. But please verify you've done exactly what is written or know why you shouldn't before proceeding. You may want to print these instructions before continuing.
    Also note that this applies to the currrent java version installed on "standard" windows systems, only.
    To download the current version of Java, go here:
    http://java.sun.com/j2se/1.4.2/download.html
    and click on the word DOWNLOAD in the column labeled SDK in this line: Windows Offline installation (info)
    After downloading, click on this page of installation instructions and read through #6:
    http://java.sun.com/j2se/1.4.2/install-windows.html
    Install the software according to the preceeding instructions. If you encounter
    problems, see the section "Troubleshooting the Installation" in the installation instructions.
    Below is a Helloworld program, copy and paste it into your editor and save it as "HelloWorld.java" Use capitalization, Java is case-sensitive. If you're using Notepad, quote the name when saving, otherwise Notepad adds ".txt" to the name. Go to DOS/command window and check that you've got the file where you want it and that it's named correctly.
    -------save this program as HelloWorld.java--------
    public class HelloWorld {
    public static void main (String[] args) {
    System.out.println("Hello World!");
    In the same directory as HelloWorld.java, enter "javac" - the program should print out a list of options, if not, set your PATH - see below.
    In the same directory as HelloWorld.java, enter "javac HelloWorld.java" and the javac compiler will create HelloWorld.class. If it was successful it will not give any messages. Check that the file is created.
    In the same directory as HelloWorld.java, enter "java -classpath . HelloWorld" with the spaces and the period. The program will run. If it doesn't, recheck that you followed the instructions.
    Here is additional information:
    The Windows path is a set of pointers that Windows uses to locate programs that you execute, like javac.exe and java.exe. This setting is explained here:
    http://java.sun.com/j2se/1.4.2/install-windows.html - 5. Update the PATH variable
    (you should have already done this as part of the Java installation)
    The CLASSPATH is another set of pointers that is used by Java to find the files that you create and want compiled and/or run. This setting is explained here:
    Setting the Classpath:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    [NOTE: always start your classpath with ".;" which means the current directory. See my classpath, below]
    How Classes are Found:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.2_01\BIN;C:\PROGRA~1\UTILIT~1;C:\PROGRA~1\WIN98RK
    This is my classpath
    CLASSPATH=.;C:\mjava;C:\mnrx;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.2_01\lib\tools.jar;C:\NetRexx\NrxRedBk

  • NIGHTMARE! Signed Applet - No Access. Please Help.

    Hi:
    I'm trying to make a signed applet gain access to my directory structure.
    I created a simple applet to test with one line:
    sErr = System.getProperty("user.dir");
    The code is below.
    I sign it using the following:
    keytool -genkey -keyalg rsa -storepass MyCerts
    As you can see I'm using the default keystore but I've tried it by using -keystore MyKeystore too.
    It runs me through all the questions which I answer, no problems.
    Then I sign it:
    jarsigner -signedjar SSignedApplet.jar SignedApplet.jar MyCerts
    It asks for the passwords which I enter.
    It completes without error and the SSignedApplet.jar file shows up in the directory.
    If I open the signed jar file it has all 3 of the files in the META-INF folder and the Manifest file looks right to me.
    I upload the jar and the Default.asp file to a Web server (I've tried localhost and a remote host).
    I open the page and the pop up comes up asking if I want to trust the unverified applet. I click 'Run'.
    Once the applet is 'Started' I click the 'Get Properties' button and I get the error:
    access denied (java.util.PropertyPermission user.dir read)
    I've tried 2 examples that work fine on my machine (that I didn't write).
    The first is by Francois Orsini (Derby Demo) and the other is by Laura MacDougal (successfully wrote a file to my user.dir directory).
    No matter what I do, I can't sign an applet and make it access anything.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en-US">
    <head>
    <script language="JavaScript" type="text/javascript">
    <!--
    function getProp()
         oApplet = document.SampleApplet;
         oApplet.getProp();
         alert(oApplet.sErr);
    // End SCRIPT -->
    </script>
    </head>
    <body bgcolor="#ffffff" style="margin:0px auto;width:800px;padding:0px">
    <form name="fmLogin" action="" method="POST">
    <table width="650" align="center" cellpadding="0" cellspacing="0">
         <tr>
              <td>Login</td>
              <td><input name="Login"></td>
         </tr>
         <tr>
              <td>Password</td>
              <td><input name="Password"></td>
         </tr>
         <tr>          
              <td colspan="2"><input type="button" onclick="getProp();" value="Get Property"></td>
         </tr>
    </table>
    </form>
    <APPLET CODE="SignedApplet.SampleApplet.class" WIDTH=1 HEIGHT=1 NAME="SampleApplet" ARCHIVE="SSignedApplet.jar"></APPLET>
    </body>
    </html>
    package SignedApplet;
    import java.applet.*;
    import java.io.*;
    import java.util.*;
    public class SampleApplet extends java.applet.Applet {
        public String sErr = "";
        public void init() {
            // TODO start asynchronous download of heavy resources
        public void getProp()
            try
                sErr = System.getProperty("user.dir");
            catch(Exception exp)
                sErr = exp.getMessage();
        // TODO overwrite start(), stop() and destroy() methods
    }

    Thank you for reading my reply in your other thread:
    http://forum.java.sun.com/thread.jspa?threadID=762212&messageID=4368224#4368224
    If you've really run through it you would have known that code called from
    javascript is not trusted and you have to use doprivileged (hey its in bold...
    why would that be?).
    Call getProp from init within the applet and you've got no problem.
    As for your imageIcon, creating one with string as a parameter
    the string is used as input for a File. I had no problem loading one with a signed applet.
    I'll post the example later in your other thread.

Maybe you are looking for

  • Fax and Print

    Hi , Can we setup the fax number / printer dynamically for bursting in BI Publisher? Regards, Saurabh

  • Spaces getting truncated in 2D barcode

    HI, I am facing an issue with 2D bar code output where variables with fixed legth are concatenated assigning offset without concatenation statement, the issues is if the length of variable is 24 , value is of 18 characters then the remaining 6 spaces

  • Special procurement key 65 in MRP view.

    Hi gurus, I have two plants A & B. A = manufaturing plant. B = planning plant. In plant A, we have maintained special procurement key as 65(withdrawl from alt.plant B) In plant B, we have maintained special procurement key as 55 (production in anothe

  • F110 - Print Preview

    Hi, How can we see the print preview after completion of F110 without going to Spool Request. Our Technical consultant want to see the print preview, our spool requests are taking lot of time and those requests are appearing after one or two days onl

  • Multi-language support for ABSL messages

    Is there some best practice or feature for multi-language support of ABSL messages (as it exists for the UI since 3.5). Currently we are maintaining messages in several languages (one message entry in the BO per language) and depending on the current