Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6559449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:19:42+00:00 2026-05-25T13:19:42+00:00

i have applet which in turn is connecting to server for filewriting .When i

  • 0

i have applet which in turn is connecting to server for filewriting .When i tried to connect to the server using localhost :
it works on my machine (server is on the same machine ), but doesnot work on other machine .

when i try with IP address it works no where

my applet code :

public class dynamicTreeApplet extends JPrefuseApplet {

    private static final long serialVersionUID = 1L;
    public static int i = 1;
    public String dieasenameencode;
    public void init() {

        System.out.println("the value of i is " + i);
        URL url = null;
        //Here dieasesname is important to make the page refresh happen 

        //String dencode = dieasenameencode.trim();
        try {
            //String dieasename = URLEncoder.encode(dencode, "UTF-8");
            // i want this piece of the code to be called 
            url = new URL("http://localhost:8080/docRuleTool/appletRefreshAction.do?dieasename=");
            URLConnection con = url.openConnection();
            con.setDoOutput(true);
            con.setDoInput(true);
            con.setUseCaches(false);
            InputStream ois = con.getInputStream();
            this.setContentPane(dynamicView.demo(ois, "name"));
            ois.close();

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (FileNotFoundException f) {
            f.printStackTrace();

        } catch (IOException io) {
            io.printStackTrace();
        }
        ++i;
    }

}

java policy file :

grant {
  permission java.net.SocketPermission "*", "accept";
  permission java.net.SocketPermission "*", "connect";
};

my jar are not signed and i donot want them to be signed as well from maintaince perspective .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:19:43+00:00Added an answer on May 25, 2026 at 1:19 pm

    it works on my machine (server is on the same machine ), but doesnot work on other machine

    Yes but it really only makes sense for the applet being served from ‘the other machine’ to be writing back to ‘the other machine. The code above has..

    url = new URL("http://localhost:8080/docRuleTool/appletRefreshAction.do?dieasename=");
    

    Which means the applet coming from the other host is attempting to write the data back to a ‘localhost’ that probably does not exist. Instead, your applet should form the URL using something more along the lines of..

    url = new URL(getDocumentBase(), "/docRuleTool/appletRefreshAction.do?dieasename=");
    

    If the code does that, it should be able to remain sand-boxed.


    And as an aside, policy files are really only of use for development purposes. If the code needs trust for real world deployment, it needs to be digitally signed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an applet which have to read a file from server. But I
I have an applet which when I test run in Eclipse works perfectly yet
I have an Applet which is loading images over a http connection using URLConnection.
So I have this applet which loads images from a directory but it looks
I have a created a simple applet which sends mail by using smtp.gmail.com on
I have an applet which displays some data using circles and lines. As the
I have a Java applet which displays an interactive map. By using the scroll
I have an applet which runs in a browser and is called from Javascript.
I have written a java applet which opens a JFrame (so when run in
I have a client application which runs as a Java applet from a user's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.