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 6801941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:09:46+00:00 2026-05-26T19:09:46+00:00

I have a website with a Java Applet and that applet needs to connect

  • 0

I have a website with a Java Applet and that applet needs to connect to my server.
This works in JApplets @Override init() but not in my own functions that are being called by javascript.

final URL url = new URL(SERVER_URL + action);
System.out.println("url:" + url);
System.out.println("postString: " + postString);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if(!postString.isEmpty()) {
    connection.setRequestMethod("POST");
    connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    connection.setRequestProperty("Content-Length", Integer.toString(postString.getBytes().length));
    connection.setUseCaches(false);
    connection.setDoInput(true);
    connection.setDoOutput(true);

    System.out.println("connecting...");
    connection.connect(); // same with connection.getOutputStream();
    System.out.println("connected");
    ....

website:

<a href="javascript: document.applet.update();" title="update from server">Update</a>
<applet id="applet" archive="/public/Antucation-0.1.0.jar?random=3765332307555812156" code="de.antucation.controller.Controller.class" width="100%" height="800px">
<param name="colonyId" value="1">
</applet>

output:

url:http://localhost:9000/applet/showCode
postString: colonyId=1
connecting...

I have a try catch around it with a System.out call but nothing happens there either.
However this works absolutly fine:

@Override
public void init() {
    update();
}

Oh and the applet of course also comes from http://localhost:9000/

How do I work around this or fix it?

  • 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-26T19:09:47+00:00Added an answer on May 26, 2026 at 7:09 pm

    Try something along the lines of:

    public void callFromJavaScript(final String param) {
        AccessController.doPrivileged( new PrivilegedAction<Void>() {
            public Void run() {
                // call code to make the connection..
                return null;
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, on a website, I have a Java applet that displays graphs with
I have an ASP .NET website that hosts a Java applet. The Java applet
I'm trying to use Java Applet for my website. but I have a problem
I have website on the server, which is not precompiled (with source code, so
I have a website that is perfectely centered aligned. The CSS code works fine.
We have a memory intensive java applet that runs in IE. The client is
I'm accessing a java applet that is running on a website (which i can't
I've developed a website (internal website behind a firewall) that uses a Java applet.
I have a pretty basic java applet that allows users to use a signature
I realsie that similar questions have been answered here about this problem but im

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.