Applets with JNLP

Hi,
I'm trying to create an applet using JWS technology. My previous applet was able to communicate with javascript (using JSObject) in order to open a link in a new window.
With JWS, when the applet is launched, it is run in a new "window" but not in an explorer. So when I use the getWindow() method, I can't get the real window to execute
JSObject win = JSObject.getWindow(applet);
            win.eval("window.open(' "+ event.getURL() + "')");Which launches an exception (win is null).
Is it possible to open links from an applet using JWS???
Thanks,
klypso

The problem is you don't bring the applet up in a browser, so the JSObject does not exist. The way I handled this is to:
First determine the operation system:
String os = System.getProperty("os.name");
Then find Internet Explorer or whatever browser you want to use depending on the OS:
StringBuffer sb1 = new StringBuffer();
sb1.append("C:\\Program Files\\Internet Explorer\\Iexplore.exe ");
sb1.append(localURLStr);
Runtime rt = Runtime.getRuntime();
try {
if (os.equalsIgnoreCase("Windows 2000") ||
os.equalsIgnoreCase("Windows XP")) {
rt.exec(sb1.toString());
where localURLStr is the URL you want to display

Similar Messages

  • Jgol error with JNLP Applet Launcher

    I've been able to deploy my applet with the JNLP launcher and jogl, but whenever I try to use an animator in my program applet crashes with this error. Am I forgetting to add something in the code? Any help is appreciated.
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/jogamp/opengl/util/Animator
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: com/jogamp/opengl/util/Animator
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         at java.lang.Class.getConstructor0(Unknown Source)
    and other stuff.
    My html code is
    <applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
    width=600
    height=400
    archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,
    http://download.java.net/media/jogl/jsr-231-2.x-webstart/nativewindow.all.jar,
    http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl.all.jar,
    http://download.java.net/media/gluegen/webstart-2.x/gluegen-rt.jar,
    https://sites.google.com/site/popesdev/ElementLearner.jar">
    <param name="codebase_lookup" value="false">
    <param name="subapplet.classname" value="ElementLearner">
    <param name="subapplet.displayname" value="ElementLearner">
    <param name="noddraw.check" value="true">
    <param name="progressbar" value="true">
    <param name="jnlpNumExtensions" value="1">
    <param name="jnlpExtension1"
    value="http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-core.jnlp">
    <param name="java_arguments" value="-Dsun.java2d.noddraw=true">
    <param name="jnlp_href" value="https://sites.google.com/site/popesdev/ElementLearner.jnlp">
    </applet>
    My jnlp file is
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp href="ElementLearner.jnlp">
    <information>
    <title>ElementLearner</title>
    <vendor>Sun Microsystems, Inc.</vendor>
    <homepage href=""/>
    <description>ElementLearner</description>
    <description kind="short">Brian Paul's Gears demo ported to Java and JOGL.</description>
    <offline-allowed/>
    </information>
    <resources>
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
    <property name="sun.java2d.noddraw" value="true"/>
    <jar href="https://sites.google.com/site/popesdev/ElementLearner.jar" main="true"/>
    <extension name="jogl-all-awt" href="http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-all-awt.jnlp" />
    </resources>
    <applet-desc
    name="ElementLearner"
    main-class="ElementLearner"
    width="600"
    height="600">
    </applet-desc>
    </jnlp>

    p0pes wrote:
    running JaNeLA gives me this error.
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'extension'. One of '{property, package}' is expected.
    The help here http://pscode.org/janela/help.html really didn't help too much.
    The help for that error states:
    This one fools a lot of people. It most often means that elements are out of the correct order in the launch file. Check the spelling, then try shifting the element further up the document. Did you check the file against the documentation for creating JNLP files? Did you try reordering the elements? Did you check the spelling of the element name?
    Note that those type of errors are produced by the J2SE based XML APIs when validating an XML document against an XSD. That means that there should be thousands of hits across the internet that discuss that error.
    Any other ideas?Some:
    - Do not expect the people here to spoon feed answers to you.
    - Describe what actual methods you used to try and resolve the error, rather than just state the tools are 'not that helpful'.
    - Mention whether the JNLP can be launched as a free floating app., like I suggested you try. After all, we are not psychic.
    It might be obvious that I am a little irritated by your reply. JaNeLA was primarily written by me, though it has significant contributions from another developer. It was written for the purpose of helping people to validate JNLP files and resources, but the user must be able to think for themselves & do some research, in order to get good use from it.
    When I initially saw the thread to do with a problem in regard to the JNLP applet launcher, I was about to pass it by completely. These forums are not for providing support for 3rd party APIs. But since the JNLP was obviously wrong I decided to give you some help on that, in the hope that would solve the problems.
    If it doesn't solve the problem, or if you continue with this 'helpless lamb' attitude, I will be opting out of the thread.

  • Java 7: Problems launching applets with jars on "file://" location

    Hi,
    We are experiencing a problem when updating our client's JRE from Java6 U 21 up to Java7 U 55.
    We have developed an Applet which is composed by several JAR files. Some of those JARs must be stored in local drive, and the JAR with the main Java class is stored on server.
    Let's supose we have a similar scenario like this:
    https://blahblahbah/bar.jar
    https://blahblahbah/test.html
    C:/foo.jar
    The code of test.html:
    <embed
      archive="file:///C:/foo.jar"
      cache_archive="bar.jar"
    />
    This code works fine on Java 6 and Applet is correctly loaded.
    However, with Java 7 a security exception is raised when trying to load JAR files from "file:///" location during Applet launch:
    java.lang.SecurityException: Permission denied: file:/C:/foo.jar
        at sun.plugin2.applet.Applet2Manager._loadJarFiles(Unknown Source)
    We have tried several tests using a java.policy file which grants all possible permisions:
    grant codeBase "file:/C:/foo.jar" {
        permission java.security.AllPermission;
    grant {
      permission java.security.AllPermission;
    We also tried to low Java's security level to "MEDIUM", with no success.
    We finally only managed to run the Applet if we explicity disable the "Next-Generation Plugin" with Internet Explorer 8. However, that's not a suitable solution, and still does not work with Mozilla family browsers.
    Eventhought with Mozilla browsers is still not working.
    Is there any restrictions in Java 7 that prevents to read jars from being loaded from local drive when launching Applets?
    Thanks in advance,

    Thank you baftos.
    I had read the whole message before posting mine. It's not the same problem. I'm able to run the sample signed applet always having the jar in the same location than the HTML page serving the applet via JNLP:
    <jar href="SignedAppletTest.jar" main="true"/>
    However, the security exception raises when trying to read that jar from local drive:
    <jar href="file://C:/SignedAppletTest.jar" main="true"/>
    ExitException[ 3]java.lang.SecurityException: Permission denied: file://C:/SignedAppletTest.jar
        at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
    I have even tried to decompile JNLP2Manager class, without seeing anything useful on that loadJarFiles method
    The only way I managed to avoid the problem is unchecking the New Generation Plugin and running the Applet with IE. Not a suitable solution for me at all..

  • Java Class not found when starting applet with ip address

    Hi @all,
    we use Application Server 10gR2 with Java 1.6.0_20 and we start the applet with an JNLP File.
    When I use the url http://lhhap03/forms/java the applet starts as it should. But when I change the entry to http://192.168.17.208/forms/java i get the error:
    Exception in thread "thread applet-oracle.forms.engine.Main-1" java.lang.NoClassDefFoundError: org/apache/regexp/RE
    Now I´m a little bit confused why i can´t use the ip address instead of the dns name from the server?
    Which config I have to change that i can get the access to jar libraries with the Ip - Address
    Best regards
    thomas

    Problem Solved, I put many environment variables  in the .bash_profile file, the CLASS_PATH will overwrite the weblogic server's classpath during startup.
    Remove them and restart server solved my problem.

  • Launching a JWS-based applet with dynamic parameters

    Hi all,
    is it possibile to return a jnlp content for an applet with session-related parameters in a dynamic manner through cgi?
    I've got a cgi program which authenticates the user and, after some forms, launches an applet passing some parameters to it (a "userid" and others user-specific).
    This works, but now I'd like to use JWS.
    So From:
    cgi --> html applet with user-specific parms --> browser
    I'd need something like:
    cgi --> jnlp with html applet with user-specific parms --> browser
    Any idea?
    thanks in advance
    marco

    Write the cgi in a way that it does not only check the user permissions but that also, if successful, prints out a html page that includes a link to a freshly generated jnlp file, generated by that cgi script just after authorization was
    successful.
    You can put command line args in a jnlp, so generate those parts of the jnlp according to your demands.
    Regards,
    Marc

  • How can use Applet through JNLP

    I have an applet and want it run in browser with the advanced featrue of JNLP like once-download,accessible to local files...
    Could anyone tell me how can I make JAR and write JNLP file to realize this?
    Thanks ahead

    I've been using an applet for several months with JWS and it works just fine. You can deploy the same code via JWS or it as an applet in a web page.
    NOTE: The JFrame and ContentPane from the browser and JWS act a bit different, and you need to test your applet in both environments in order to get JMenu's to attach correctly, and if you're using JFrame methods setResizable() or setDefaultCloseOperation().
    Here's my jnlp (server names xxx'd out)
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://xxx/Install/">
    <information>
    <title>Spool Window</title>
    <vendor>Barr Systems, Inc.</vendor>
    <homepage href="http://www.barrsystems.com/" />
    <description>Remote Spool Window for BEPS</description>
    <icon kind="splash" href="beps.gif"/>
    </information>
    <security>
    <all-permissions />
    </security>
    <resources>
    <j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se" />
    <jar href="JNLPSpoolWindow.jar"/>
    </resources>
    <applet-desc main-class="SpoolWindow" name="Spool Window Welcome" width="1024" height="700">
         <param name="WebService" value="http://xxx/BepsWebService/Service1.asmx"/>
         <param name="Rows" value="40"/>
         <param name="CellHeight" value="18"/>
         <param name="StartingWidth" value="1020"/>
         <param name="Debug" value="0"/>
         <param name="DrawNewWindow" value="0"/>
    </applet-desc>
    </jnlp>

  • Launching an applet with java web start

    Is there a way to launch an applet with java web start? That is, to have the java appelt run in a browser but get deployed with a jnlp-file and have all the benefits of java web start?
    Robert

    http://www.physci.org/jws/#jtest

  • Can't Copy text unless console is opened before applet with JTextField

    If an applet uses JTextFields, it is impossible to copy text from the console to the clipboard (or anywhere else) if the console is opened after the applet.
    See http://demo.capmon.dk/~pvm/nocopy/nocopy.html for a working applet with source and class file to try it out on...
    So if something bad has happened, and there are hints in the console e.g. a stack trace, it all has to be retyped by hand, since all Copy or export is impossible...
    Does anyone know of a workaround for this? I'd like to be able to e.g. copy stack traces to bug reports.
    Try these test cases:
    * Close all browser windows. Open a browser and visit this page. After the page with this applet has loaded, then open the console with "Tools/Sun Java Console" (or "Tools/Web Development/Java Console" in Mozilla). Select some text in the console. There is no way to put this text on the clipboard; the "Copy" button doesn't work, and neither does CTRL+Insert, CTRL+C or anything else.
    * Close all browser windows. Open a browser window no some non-java page and then open the console with "Tools/Sun Java Console" (or "Tools/Web Development/Java Console" in Mozilla). Then visit this page. Select some text in the console. Now the "Copy" button does work, enabling "export" of e.g. stack traces to other applicaitons e.g. email.
    The difference is which is opened first: The console or the applet. If you look at the very rudimentary Java source code, it is the mere creation of a JTextField is what disables or breaks the Copy functionality.
    I've tried this on Windows XP with IE 6.0 and Mozilla 1.3 and they behave exactly the same. The JVM is Sun's 1.4.2 and I've tried 1.4.1_02 also with the same behavior. I've also tried javac from both 1.4.2 and 1.4.1_01

    hey .. this seems like a bug.. can you please file a bug at
    http://java.sun.com/webapps/bugreport
    thanks...

  • Help! How to Open a Frame from applet with

    Hey all. I need help =).
    I want:
    1. Have 1 class extends applet with running thread (this far no prob)
    2. Open a new frame from the applet (no prob)
    3. Start a new thread which is operating "inside" the new Frame/class
    4. Draw a simple Rect in the new Frame with the new thread to test that the graphics work.
    Plz help,
    ~Trobsky

    �rr..... i cant draw on the Frame =(.
    Heres the code:

    public class Fonster extends java.applet.Applet {
         Frame myFrame;
         Fri friFonster=new Fri();
         public void init() {
              myFrame=new Frame();
              myFrame.resize(300,300);
              myFrame.show();
              myFrame.add(friFonster);
              friFonster.init();
              friFonster.start();
         public void paint(Graphics g)
              g.drawRect(10,10,100,100);
    public class Fri extends java.applet.Applet {
         public void init(){
              repaint();
         public void paint(Graphics g)
              g.drawRect(10,10,200,200);

  • How to make an applet with curved edges in the browser

    Hi all,
    I m doing an applet application in which i want to show an image inside a player in the website. The edges of the player is designed in curved shape. So i too wanted to do an applet with curved edges. Otherwise my applet and the images are coming out of the player... do any body have come across such a problem. please give me some suggestions. Awaiting for your suggestions and solutions. If u don't understand what i m trying to say let me know..
    Thanks...

    I tried to get the screen height -1 and subtract from
    all the ys in my applet but it doesnt work all the
    time. I am drawing shapes and stuff with an algorithm
    I wrote for class.
    is there a way to get origin(0,0) to the lower left
    screen easily.
    thanksThe only way I can think of would be write a method to convert a "normal" y coord to an applet y coord. That would probably end up being a huge pain in the ass, since you would have to pass all y coords through it before using them, so I suggest you just get used to y being upside down.

  • Is it possible to replace applet with JSP

    I m working for the extension of the a Chat Application which is Applet based...
    It is slow as the Applet loaded...
    Is it possible to replace the applet with th JSP....
    what r the pro and cons of it???
    Thanks in advance...

    sure it is possible.
    main difference is, that applet maintance a permanten connection to the server and therefor has a 'smaller' communication where as with servlets/jsp the client will have to communicate more information for each request.
    have a look at pushlets.com, a servlet based framework that keeps the connection to the client open (works with hidden frames and dhtml). very smart framework.

  • How to write a applet with multiple menu

    Hi all,
    How to write a applet with multiple menu or please tell me where can I get a examples
    thanks

    i'm writing a project and it seem not work with browser. If anyone can help please leave me a e-mail so that i can send my source to you.
    Thanks so much

  • Jms signed applet with SP3

    Hi,
              I am using a thin client version of weblogic client & jms jars for my signed applet.I am getting an exception when I try to initialize the applet without closing the browser window. This was an issue in SP2 and was reportedly fixed in SP3 but for some reason I dont see it working.
              I am using 1.4.2_05 as the jre for my java plugin and 8.1 SP3 for my weblogic. I see the messages these messages being printed in the logs
              +++ <Warining> Don't have permissions to access ThreadGroup. We strongly recommend to use signed applet.
              +++ <Warining> Proceed further without creating ThreadGroup.
              +++ <Warining> Don't have permissions to access ThreadGroup. We strongly recommend to use signed applet.
              +++ <Warining> Proceed further without creating ThreadGroup
              This is the exception that gets thrown when you try to start the applet again without closing the browser window.
              javax.naming.NamingException: Unhandled exception in lookup [Root exception is org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 208 completed: Maybe]
                   at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:81)
                   at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:237)
                   at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:171)
                   at javax.naming.InitialContext.lookup(Unknown Source)
                   at com.vz.inms.client.applet.MyApplet.init(MyApplet.java:84)
                   at sun.applet.AppletPanel.run(Unknown Source)
                   at java.lang.Thread.run(Unknown Source)
              Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe
                   at com.sun.corba.se.internal.iiop.IIOPConnection.purge_calls(Unknown Source)
                   at com.sun.corba.se.internal.iiop.ReaderThread.run(Unknown Source)
              But in my case, the applet is signed and I can see it in the trace as well as I get a prompt whether I want to accept the signed applet when the applet is about to be invoked. I have signed the applet using my own certificate instead of one from verisign or other CA's. I dont think it should matter.
              Does anyone know if this was really fixed in SP3?
              This is what documentation for resolved issues for 8.1 SP3 says :
              CR120811
              When using the WebLogic thin client with an applet, concurrentModificationExceptions and JMSExceptions were thrown. Investigation showed that there were two problems:
              There was a problem with the Sun ORB implementation. An applet's virtual machine released AppletContext upon a browser refresh and stopped all threads in the applet context's thread group. When an ORB was initialized as part of an applet context, the reader threads were created in the applet context's thread group. When the browser was refreshed, the ORB reader threads were also stopped.
              The WebLogic thin client created two threads in the applet context group: a HeartbeatMonitor thread and a RequestTimer thread. When the browser was refreshed, these threads were stopped with others in the applet context group.
              The problems were solved with the following changes:
              The Sun ORB implementation changed in JDK 1.4.2_04 so that it creates the reader threads on a child thread group of the system thread group but not to the applet's context thread group. This change ensures the reader thread stays alive as long as the orb is alive or applet's JVM is alive.
              The WebLogic thin client TunnelResponse and HeartbeatMonitor threads are now created on a child thread group of the system thread group but not to the applet's context thread group. This change ensures these threads stay alive as long as applet's JVM is alive. The fix is provided only for signed applets.
              I would really appreciate if someone could give any insight to this problem.
              Thanks,
              Jatinder

    I am also getting this error.
              BEA...is it possible to use an applet with JMS without signing it?

  • Signed applet with jdk1.4.2

    Hello, friends! I'm having difficulties running an applet with jdk1.4.2. This applet was working properly with the previous version, jdk1.4.1. Perhaps I've forgotten some details or some changes in the new version. Any idea?
    Thank you.

    Hi there,
    I am also facing similar problem. Please read the following.
    I have a query regarding JRE 1.4.2_03. What does it have, which makes it differ from JRE 1.4.1_02 ? Actually, I am asking this question, because I have a signed JApplet where, user's select a file displayed in client JApplet's JTable and stores it to the specified location on his/her local drive. The JApplet runs perfectly well running in IE 6.0 with JRE 1.4.1_02. But, gives error on IE 6.0 with JRE 1.4.2_03.
    Any help regarding the same will be helpful...
    I tried a Signed applet with no GUI in it which runs well on JRE 1.4.2_03.
    Both the applets are signed with jdk1.1.6.
    Thanking you in advance,
    Ganesh A Baviskar.

  • Applet with javascript opening new window

    I have an applet with a url link in it that opens a new browser window:
    getAppletContext().showDocument(new URL("javascript:window.open('http://www.javasoft.com', 'JavaSoft',''")));
    It opens a new window perfectly, but leaves the page in the main window and displays "[object]" on the screen. Is there any way to stop it from leavin the page in the main window?

    try this
    getAppletContext().showDocument(new URL("javascript:window.open('http://www.javasoft.com', 'JavaSoft','';window.close()")), "_blank");
    Let me know if you have found a solution since.
    Hope this helps.
    R

Maybe you are looking for