Applet development and embedding in browser

Can someone point me to a tutorial or docs that show me how to make a small applet in Java and then the actual tags to embed it in the browser (IE or Firefox)?
Specifically I a looking to make an applet that can be controlled by Javascript to open a socket on the server (same computer the web page and applet will be on) and do some back and forth communications with an application that runs there.
Thanks

If you want to incorporate an applet in a JSC project, see this resource:
Adding Applets to Web Applications Built with Sun Java Studio Creator 2
(A link to it is at the top of this forum's topic listing.)
If you want to create an applet to run in a web browser (that is, not related to a JSC project) see here:
http://java.sun.com/docs/books/tutorial/deployment/applet/index.html

Similar Messages

  • Applet, Frame and fullscreen

    Hi!
    Have an application wich is a Applet and also can run as a desktop program. The fullscreen desktop function some time ago sotpped work, now I have been testing to discover the problem and discovered the Applet does not work correctly when inside my Frame, the Panel class also does not work, only the JPanel is drawed in my fullscreen.
    So, I want to ask why the Applet does not work anymore when the Frame is in fullscreen exclusive mode?... and what is the best practice in this case, because I want my game to run in desktop and inside web browser?
    Thanks in advance

    Janio wrote:
    Ok, the browser window wrapper does nothing in particular, in fact it can be replaced by a Frame using java web start, but maybe the users will get intimidated by this approach.And maybe they won't. Developers seem to have a greater fear of apps. launched using JWS than users do.
    Note that an app. launched using JWS will work for more users than an applet. There are constant browser/JRE interaction bugs discovered, that trip up applet deployment.
    I just want an alternative for this problem with Applets inside frames.Applets can be dropped into a frames, but it requires some extra hassles. If you control the code, I would not recommend going that way.
    (And now I re-read this thread from the top..)
    I am confused by what you mean by 'full-screen' in combination with 'applet'. An applet embedded in a web page has its size set in HTML. If you want something to be full-screen, it would require the applet launching a free-floating (J)Frame, (J)Window or (J)Dialog (etc.). Is that what it does?

  • JPDK java applet development

    Hi,
    I've been trying to develop a java applet application and deploy it on a portal page. I managed to use a HTML portlet to link the java applet through an URL. So far so good. But then I wonder is that a good way for this implementation? Can anyone share their experience.
    Furthermore, I'm trying to use the portal SSO for login. Is there any Java api to retrieve the SSO user id, so that I can past it to my Java applet application. I'm very interested for any sample code.
    Thanks!

    Hi Kevin,
    It is possible to develop a JPDK portlet and use it for deploying an applet on the client end. I have developed a simple example of a telnet portlet which is basically an applet which has been embedded into the portlet. The sample is available on Knowledge Exchange. You will need to sign-up for it, if you havent yet.
    http://portalstudio.oracle.com/pls/ops/community.comm_folder_download.get_item?p_folderid=538287&p_itemid=569449&p_caid=233
    Secondly, if your applet intends on accessing system resources on the client end, then you will have to sign your applet jar file.
    You can use the JPDK APIs to retrieve the userID (provided you only need the user id).
    PortletRenderRequest pReq = (PortletRenderRequest) request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    pReq.getUser().getName();
    Hope that helps,
    thanks,
    Harsha

  • Responsive Mobile Menus: Open and close on browser, but not in mobile?

    I have two responsive jquery menus I am working with. In the desktop browser they both look and operate fine (full screen and mobile size), but when that same responsive page with menu is viewed on an actual phone (Android and iphone), the menus both: SHOW FULLY OPENED WITH ALL PARENT AND CHILDREN?
    I believe I installed everyting properly (especially since it resizes and works perfect in a normal desk browser) -Dropsdown and Contracts back.
    Does anyone have any experience with this issue (Responsive menus works fine in a desktop browser, but shows completely opened, and will not drop or contract when viewed on an actual mobile phone, like Android or iphone?), and if so any guidance?
    Thanks very much

    Wow, you save me alot of time and headaches. You really know alot and are very helpful and taught me alot. Thank you for helping me, this is my first site I am still trying to build/get up, after years of on-off trying / learning/ abandoning (for other pursuits). This site is really important for me, and would mean alot for me to finally follow through on building.
    Do you know if this forums allows (or do you ever) add friends/contacts so you can message each other? I am somewhat a 'newbie', so I understand if problem, I would not bug/bother you, just curious and fully understand if not. (or do you ever contact via email, website, or other)?
    Also re: Vanilla Testing: I always test all my stuff on a blank HTML page with only the Boilerplate and JS that Dreamweaver provides. I don't know if I have the capability to fully do in something like notepad? Will this method (Boiler, JS, and blank HTML) suffice--No other Scripts--Not even my stylesheet?
    What do you think about this menu. Features seem good, has the most sales, good developer and support?
    http://themes.pixelworkshop.fr/?theme=MegaMenuCompleteSet

  • Applet can not run in browser, but it wroks in appetviewer. Why?

    I wrote a very simple applet, and it works well when I use appletviewer. But when I use browser to open the html file which contains the applet, it always gives no class found error. My browsers are IE5.0 and Netscape4.77. Hwo can I make the applet run in browser?
    Quick response is greatly appreciated.

    see you have to put the proper code base in your html file.check if your browser is java enabled or not.Java plugin comes with IE 5 and it automatically get installed if you won't disagree with that.Check in optin menu of ur browser that java is enabled or not.
    Applet works fine with all browser.
    2nd thing when you r running applet through appletviewer,it runs as an application from your local JVM while running through browser means you are running applet through browser 's JVM.

  • Applet does not run in Browser

    Iam using Windows XP and IE 6.0. Applets do not run in my browser. Hovering the cursor where the applet should be in the browser, I get a Class not found message. Setting the CLASSPATH variable did not help. Any suggestions?

    You might find an answer in this new page
    [url http://java.sun.com/j2se/1.4.2/docs/guide/deployment/deployment-guide/upgrade-guide/index.html]Java Upgrade Guide: Migrating From the Microsoft JVM to the Sun JRE

  • Applet JNLP not accessible in browser ?

    Hello,
    I am new to java and to programiing in general. Thanks in advance for your help. I can't get an Applet to work in any browser (Google, Mozilla, IE) while it works fine in appletviewer. Why?
    The Source:
    import java.awt.*;
    public class Hwa extends java.applet.Applet {
    public void init (){
         add(new Label("Hello World"));
    compiled in Hwa.class, then in a Hwa.jar file,
    The JNLP file:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
    <information>
    <title>Hw Applet</title>
    <vendor>CCN</vendor>
    </information>
    <resources>
    <j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se" />
    <jar href="http://www.ccca.eu/Hwa.jar" />
    </resources>
    </jnlp>
    The HwaAPJNLP.html file:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html dir="ltr" lang="fr"><head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title>CCCAEU</title>
    <meta content="" name="author">
    <style type="text/css"></style>
    <link rel="stylesheet" href="CCCAEU.css" type="text/css">
    </head><body>
    <applet code="Hwa.class" ref_jnlp="Hwa.jnlp" height="50" width="150"></applet>
    </body></html>
    All files are copied on the http://ccca.eu/. of the server
    Executing appletviewer HwaAPJNLP.html (local copy of the html file) works just fine BUT launching http://www.ccca.eu/HwaAPJNLP.html returns a blank rectangle with the JAVA console message "Detected from bootclasspath: C:\\PROGRA~1\\Java\\jre7\\lib\\deploy.jar" and "Incompatible magic value 1008812135 in class file Hwa". WHY ?
    FYI, the ".htaccess" file on my WebServer is
    AddType x-mapp-php5 .php
    AddType application/x-java-jnlp-file JNLP
    Thanks in advance for your support.

    Thank you Baftos. It works but I still do not understand the logic. Before, my Hwa.class was only accessible through my Hwa.jar file on http://www.ccca.eu/Hwa.jar, itself defined as the reference if the jnlp file, see above. My understanding of the jnlp logic is that the html page will load the Hwa.class from the Hwa.jar file. Is that correct ? Thanks to your post, I copied the Hwa.class directly under http://www.ccca.eu/Hwa.class and yes, when accessed through the browser, I can download it. Even better, my previous html page above - unchanged - now WORKS. Thanks for letting me know where I think wrong.

  • Applet development with JDeveloper

    Hi,
    After many years of not being on the Java bandwagon, I am now faced with having to learn Java for some small projects that I will be working on later this year.
    I have been working through the newest Core Java book. I am currently at chapter x, Applets.
    My question is, How do I run applets from within JDeveloper?
    For example, given the following code:
    package myapplet;
    <applet code="MyApplet.class" width="300" height="300">
    </applet>
    import javax.swing.*;
    public classMyApplet extends JApplet
    public void init()
    JLabel label = new JLabel("Not a \"Hello, world\" applet", SwingConstants.CENTER);
    add(label);
    How can I run it from within JDev or how can I run it in a applet viewer or regular web browser? I tried to execute it in a Firefox browser, but it does not work.
    Thanks for any help you can give me.
    Ron Reidy

    Try this:
    In JDeveloper from the new->web tier->applet create a new applet (check the "can run stand alone").
    Add your 2 lines of code to the jbinit method.
    Then you can just run the applet directly.
    The other option is if you don't check the "run stand alone", you'll go into the new->web tier->applet and create an Applet HTML. The wizard will guide you to selecting your applet. then you run the HTML page.

  • Applet Not loading in my browser???

    Iam using a IE browser (Version 6.0).i can able to run all applets which is available in my local machine.but only my browser is not supporting to run the applet from server.
    the error is
    load: class HelloApp not found.
    java.lang.ClassNotFoundException: HelloApp
         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
    at the same time web server throws the error
    [10/Aug/2004:16:11:19] warning (21240): for host 10.10.10.31 trying to GET /amserver/HelloApp.html, send-file reports: can't find /opt/apollo_portal/ps61/SUNWam/web-apps/services/HelloApp.html (File not found)
    [10/Aug/2004:16:12:41] info (21240): vs(https-expro200.immchen.com)servlet 'LoginServlet' class = 'com.sun.identity.authentication.UI.LoginServlet' loaded in context = '/amserver'
    this error is only for my machine request.not others request.
    so how to solve this browser problem.
    thanx
    parthi

    i found the answer
    open java "plug-in"
    go to the proxies tab and deselect use Browser settings..
    now it will work fine

  • Can a thread created in an applet still run after the browser is closed?

    Dear all,
    I was able to make an applet's thread keep running even the web page changed to other page. Is it possible to make a thread spawned by an applet keep running even if the browser is close? I am using signed applet and JRE1.3.1_02. Thank for answer.
    [email protected]
    Arthur Pan

    No. A thread is part of a process and if the browser closes that process will (generally) be destroyed.

  • Install Oracle XE, SQL Developer, and Toad on the same machine?

    I have been trying to install Oracle SQL Developer, Toad, and Oracle Express on my work computer. Installing SQL Developer and Toad was pretty straightforward, and I was able to browse the XE database with SQL Developer. But after installing Toad, problems started. Toad was using Oracle XE's registry settings to locate ORACLE_HOME and oci.dll. So I tried changing the settings for Oracle XE in the registry. Toad now works, but not Oracle XE. And while I was going through this all, I even had a time when I had Toad and oracle xe working, but not SQL Developer. It almost looks like you can choose two of the products, but not all three.
    So, my question to the community at large is "Can it be done?". In what directories do you have each product installed? What environment variables do you have set? Where is your tnsnames.ora? What Oracle registry settings do you have set (namely HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE)?
    I can post my current settings, but I've been through so many iterations that these current settings don't really matter that much.
    Here are the details I am looking for
    Path to sqldeveloper.exe
    Path to oracle.exe (for Oracle XE)
    Environment Variables
    ORACLE_HOME
    ORACLE_BASE
    TNS_ADMIN
    PATH (just the oracle stuff)
    Registry Settings
    HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORACLE_HOME
    HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORACLE_BASE
    HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\TNS_ADMIN
    HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\OLEDB
    HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_XE\ORAMTS_CP_TRACE_DIR

    I don't use toad, but there should be no reason why you can't install all 3. SQL Developer is a very clean install and affects nothing else. It doesn't add to the path, or create any registry entries except for file associations.
    A toad installation should pick up your oracle client (in this case the XE code). I am curious as to why you felt you had to change registry settings. What problem were you trying to fix?
    My recommendation would be to uninstall everything, clean the registry and reinstall in the order XE, Toad, SQL Developer. Test in between installations and seek help for problems as you find them. Bear in mind that this is the forum for SQL Developer. QUestions about Oracle XE would be better answered in the dedicated forum, or in the Installation forum, and questions about Toad in a toad forum.

  • Connect JavaFx(Applets) to J2EE - best practice & browser session

    Hi there,
    I’m new to JavaFX and Applet programming but highly interested.
    What I don’t get at the moment is how you connect the locally executed code of the applet to your system running on a server (J2EE).
    Of course there seem to be different ways but I would like to avoid using RMI or things like that because of the problem with firewalls and proxies.
    So I would like to prefer using HTTP(s) connection.
    And here my questions:
    1.) Is there any best practice around? For example: using HTTP because of the problems I mentioned above. Sample code for offering java method via HTTP?
    2.) Is there a possibility to use the browser session? My J2EE applications are normally secured. If the user opens pages he has to login first and has than a valid session.
    Can I use the applet in one of those pages and use the browser environment to connect? I don’t want the user to input his credentials on every applet I provide. I would like to use the existing session.
    Thanks in advance
    Tom

    1) Yes. If you look at least at the numerous JavaFX official samples, you will find a number of them using HttpRequest to get data from various servers (Flickr, Amazon, Yahoo!, etc.). Actually, using HTTP quite insulates you from the kind of server: it doesn't matter if it run servlets or other Java EE stuff, PHP, Python or other. The applet only knows the HTTP API (GET and POST methods, perhaps some other REST stuff).
    2) It is too long since I last did Java EE (was still J2EE...), so I can't help much, perhaps somebody will shed more light on the topic. If the Web page can use JavaScript to access this browser session, it can provide this information to the JavaFX applet (JS <-> JavaFX communication works as well as with Java applets).

  • Trying to log into firefox but keep getting firefox is in offline mode and can't browse the web, I've unchecked the work offline in the file menu but still get error message...

    trying to log into firefox but keep getting firefox is in offline mode and can't browse the web, I've unchecked the work offline in the file menu but still get error message...

    The work offline option can be found from Firefox button -> Web developer or from the menubar toolbar -> Work offline (Or at least thats what happens in Windows).
    Have you any other reason for being offline; router off, firefox not dialing up or whatever. Or is security software or a firewall blocking firefox, or a network connection, or firefox setting etc set wrongly.
    See also
    *[[cannot connect after upgrading firefox]]
    *[[options window - advanced panel]]
    * [[error loading web sites]]

  • Applet development problem

    hi...this is my first post in this forum....
    my problem is very strange...im a newbie at applet development.....when i wrote the following program:
    import java.applet.*;
    import java.awt.*;
    public class Display extends Applet
    Image img1;
    Image img2;
    public void init()
    img1=getImage(getCodeBase(),"Images/Duke.gif");
    img2=getImage(getCodeBase(),"Images/Sctonly2.gif");
    public void paint(Graphics grph)
    grph.drawImage(img1,10,20,this);
    grph.drawImage(img2,10,20,this);
    now on compiling this program, the compiler gives the following error...
    illegal start of expression: public void init()
    im completely stumped....why is it giving this error and what to do to correct this.
    thank you

    Remove the { before the method declaration public void init(){}
    and a } after grph.drawImage() method call.

  • Difference between Web Service Developer and Web Compononent Developer?

    What's the difference between Web services Developer and Web Component Developer? What's their job description. I'm aiming to be a web application developer. Which track should I follow?

    Here is another article on J2SE vs JEE:
    http://www.velocityrevies.com/forums/t151124-what-is-j2se-vs-j2ee.html
    I believe the people who said JSE is only for desktop development are not correct, as well as their saying their are 2 kinds of developer (web service and component).
    As I understand it, web service developers provide a way to expose the data and functionality of a program written in a particular language (such as Java or C#) as XML documents to anyone subscribing to the service over the internet. The remote applications subscribing to the service therefore can be written in any other language. For example, imagine a Cobol program trying to get data from a program written in Java. Since both cobol and Java should have ways to parse XML documents, they don't have to know each other's syntax. There are many programs written in many many languages in the web and XML is a standard way for them to communicate. Web Services are an advanced topic and you shouldn't worry about it until you master web applications and/or desktop applications.
    As I understand it, a web component developer creates java widgets that produce some visual image with basic functionality associated with it. For example, an html button. These widgets are used by other developers for the presentation layer when creating a web application or desktop application. I'm not sure about this definition since I never messed with web component development. I suggest you keep way from this specialized area on concentrate on web applications and/or desktop applications.
    You can consider application development as devided into two general categories. Web development and Desktop development (there are others). Web development is further broken down into browser based applications and mobile device applications. I suspect their are more jobs in web development than desktop development. I therefore suggest you concentrate on browder based web development (just my opinion). However, each has their advantages and disadvantages over each other, depending on the task at hand(http://stackoverflow.com/questions/905365/desktop-development-versus-web-development)
    Disclaimer:
    http://myweb.accessus.net/~090/univdisc.html

Maybe you are looking for