Java Browser Window (JDIC)

well im trying to make a browser, but when i run the project i get following error:
Exception in thread "EventThread" java.lang.NullPointerException
        at org.jdesktop.jdic.browser.internal.MsgClient.<init>(Unknown Source)
        at org.jdesktop.jdic.browser.internal.NativeEventThread.run(Unknown Source)any idea why?
import org.jdesktop.jdic.browser.*;
import org.jdesktop.jdic.browser.WebBrowser;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.net.*;
public class TEST {
    public static void main(String[] args) {
        final WebBrowser webBrowser = new WebBrowser();
        webBrowser.setSize(700,500);
        final JTextField site = new JTextField(15);
        final JTabbedPane pane = new JTabbedPane();
        JButton go = new JButton("go");
        go.addActionListener(
                new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    webBrowser.setURL(new URL(site.getText()));
                    pane.add(webBrowser);
                catch(Exception ex) {
                    JOptionPane.showMessageDialog(null,ex.getMessage());
        JFrame frame = new JFrame("Test browser");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(700,500);
        Container c = frame.getContentPane();
        c.add(site, BorderLayout.NORTH);
        c.add(go, BorderLayout.EAST);
        c.add(webBrowser, BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);
}thank you :)

it is really strange, that was what i got in netbeans 6.0, now in version 5.5.1, i get no errors, except the program doesnt load a webpage like its supposed to... (when i click the go button, the WebBrowser Area disapears)
if you look at the picture you see how it is set up, i dont know if i somehow need to import everything in JDIC? (the IEembed.exe, dll files, ect)?
http://img299.imageshack.us/img299/1322/rssmoothhf6.png

Similar Messages

  • Closing the browser window in Java

    Hi All,
    My wireless application works on a PDA browser. The PDA browser doesn't support javascript. When user wants to logoff from the application, he clicks on the logoff button. After clicking it the current browser window should close.
    I am using XHTML-MP markup language to develop the page instead of HTML.
    I need a piece of code (Example Java code, not Javascript code) in order to close the current window browser.
    Any help will be welcome.
    Shrikant

    There is no such code, I hope.I wouldn't be sure about PDAs. I haven't used one yet. But logically, there should not be any code like that.

  • How can I output text in a browser window in JAVA?

    How can I output text in a browser window in JAVA?

    "response.getWriter().print()" is the most common method when using servlets

  • Opening a new URL in an existing browser window from a Java application

    I've tried one of the many codes to open a new browser window and it works, but I need something else.
    Is there any way to open a new URL on the same window on a Java desktop application? (Changing the URL on the current browser window without opening a new one, I mean).

    You can do that by using an add-on such as:
    * NewTabURL - https://addons.mozilla.org/firefox/addon/newtaburl
    * New Tab Homepage - https://addons.mozilla.org/firefox/addon/new-tab-homepage
    Another way of opening the home page in a new tab is to middle click on the home button in the navigation toolbar.

  • Opening up a new browser window in java

    So, i'm trying to open up a browser window to download the mac runtime for java, if the system is a mac. but because of microsoft not letting java to javascript communication i can't do it. anyone got any ideas?
    thanks,
    Pete

    Hi,
    you may check the platform in your applet with
    System.getProperty("os.name"); and then open new browser window with
    getAppletContext().showDocument(url_to_download, window_name);Regards,
    Martin

  • Applet launching browser window in Java 6u10+

    Finding a problem that appears to be limited to Java 6u10+. We have an applet which opens multiple JFrame windows, and in some cases, the user might click something in the applet that should trigger the browser to show a popup browser window with some web page. That part all works fine, and the browser popup shows in the front as it should in older java versions.
    However, it appears that since 6u10, now that the applet process is separate from the browser, the popup window no longer can be brought to the front of the applets. It is being launched and brought to front with Javascript, but that only brings it in front of other browser windows, no longer in front of the applet. And the only thing I can find to resolve this is to minimize/iconify the applet windows, and that's not ideal to hide all windows.
    Is there anyone else seeing this? Has anyone found any fix or work around for this (without minimizing all the applet windows)?
    thanks

    in Java 6u10 it works?
    I guess it's similar. My applet calls showDocument(), but it is only passing a URL with query string parameters which the page called reads (via Javascript) and uses JS to call window.open() with the contents based on those parameters. I don't have access to the system to change the way the web works. The team that does has looked into it, and said they do make the tofront call in JS to push the browser window up. But it won't go up all the way, only above other browser windows, and not the applet window (which is a JFrame). Then the OS (windows in this case) starts blinking the taskbar button for the popup window for attention, but that's not helpful.
    The only common factor in the reports were that it's Java 6u10 or higher. XP, Vista, FF, IE, all had the problem with 6u10+. And knowing how Sun changed the plug-in architecture, it actually makes some sense as to why this happens. However, this seems to be something that there is no way to fix short of Sun doing something. Or as mentioned, minimize my window just to let others show up, which is going to be annoying as a user to have to restore the window to go back.

  • Is it possible in firefox to close a browser window/tab using java script without modifying the configuration settings? If YES, please let me know.

    Requirement: On click of button, I want the browser window to be closed.
    Solution: I am calling below java script on "onClick()" event of button.
    function close_window()
    window.close()
    This works in internet explorer but not in Mozilla Firefox. What is the reason behind it. Is there any way out to close the browser window in Mozilla Firefox?

    Can you post a link to a page that opens a pop-up window where a close button doesn't work?
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Opening a browser window with Java

    Is there a way I can open a Browser Window (with a specific html document) from Java? Thanks.

    Use Runtime.exec(cmd) with the following command:
    Under Windows 9x:
       command.com /C" start "urltofile.html"Under other Windows:
       cmd.exe /C [start] "urltofile.html"  (start is needed when url begins with 'http://")

  • Can't find a java script that will close browser window

    I went through the archives and found several java scripts
    for closing browser windows. Unfortunately none of the work. If I
    find one that will work on a Mac - Safari then it won't work on a
    PC - IE. I downloaded and installed that extension but cannot find
    it on my Mac menus. Running MX2004 on a Mac.
    Here are the codes I've tried and a example page:
    <a href="#" onClick="window.close()">close
    window</a>
    <a href="javascript:window.close();">{YOUR TEXT
    HERE}</a>
    <a href="javascript:window.close()">Click here to close
    this
    window</a>
    <a href="javascript:self.close();"> close window
    </a>
    Here's an example of a non working page:
    [removed to protect the company]
    and another script that doesn't work:
    [removed to protect the company]
    Thanks for all your help.

    phrarod wrote:
    > I came here to learn. It was a simple thing and I was
    embarrassed that I forgot
    > how to do it. I mentioned that. I thanked Alan. My
    friend owns that company.
    > He's trying to help me out. He's a great guy and helps
    people alot. He doesn't
    > rip anyone off or pay them a pittance. He doesn't do a
    ton of web work because
    > as you said its harder and harder to get any money since
    clients have to be
    > educated why they need you when they can get it for free
    or $300 or a couple
    > hundred. We're all trying to make a living. If someone
    helps me I want to repay
    > that help if I can. I know I'm not paying for the advice
    here and since its in
    > a forum I don't know about I can't help technically.
    Networking is always a
    > good thing. I tried to help by offering a lead. How do
    you know this person
    > doesn't pay much? Because of me? Rather than following a
    lead you just assumed.
    > I know a lot about print and TV. I'm trying to fill out
    my skill-set to offer a
    > wider range of services. End of rant. I'm just hurt I
    was stepped on as it
    > blind-sided me. I have a solution. If its so basic it
    upsets the people who
    > answer then don't answer.
    >
    Don't feel offended, the comments weren't directed at you,
    rather at the
    bizarre world of web design.
    :-) We need to hang tough and help each other, whether we're
    working
    for a decent salary, for a pittance, or for our middle-aged
    aunt.
    Bonnie
    in California
    8 ^ )

  • Can I get the URL of any other browser window in java

    Can I get the URL of any other browser window in java

    Hi, did you find the way to find the URL of the WSDL? I have the same problem.

  • Java Browser Component??

    Hi:
    Microsoft supplies an ActiveX component that is really the functionality of Internet Explorer. You can control the browser programatically and the user can view the browser window just like a normal browser.
    I wondered if Java has such a component. That is, does a component exist in J2SE that is a Web browser that I can control programmatically?

    Have a look at https://jdic.dev.java.net/

  • Generated JNLP and closing the original browser window

    Hi All, This is my first post so bear with me. Here is my problem.
    I am using Web Start for an application.
    I need to check to see if web start is installed or not.
    If it is NOT I need to auto-install
    if it is I need to call a servlet that dynamically generates the jnlp with the user that I passed in as <arguments/> maybe other arguments in the future also
    I need to shut the original browser window
    I will use this servlet in multiple web apps
    I have it working like this but I don't think it is clean enough
    I call a servlet with the syntax checkJREServlet?USER=username
    this servlet writes out:
    <html>
    <body>
    <h1>Installing Java Runtime</h1>
    <OBJECT
    CLASSID="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width="0" height="0"
    codebase="http://<myservler>/<plugins folder>/j2re-1_4_2-windows-i586.exe#Version=1,4,2,0">
    <PARAM NAME="code" VALUE="redirectAndClose.class"> //my applet class
    <PARAM NAME="archive" VALUE="RedirectUtil.jar"> //the jar where my applet class is stored
    <PARAM NAME="archive_cache" VALUE="RedirectUtil.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet">
    <PARAM NAME="where_to_next" VALUE="http://<myservler>/<mywebapp>/openAppServlet?USER=username">
    You did not install Java.
    <p>Please use the <b>Back</b> button to return to the previous page.
    </OBJECT>
    </body>
    </html>
    I have redirectAndClose which is:
    import java.applet.Applet;
    import java.net.URL;
    import java.net.MalformedURLException;
    import netscape.javascript.*;
    public class redirectAndClose
    extends Applet
    java.util.Timer timer = null;
    int seconds = 5;
    public void start()
    try
    getAppletContext().showDocument(
    new URL(getCodeBase(), getParameter("where_to_next")), "_blank");
    //now we have to close ourselves in 5 seconds
    timer = new java.util.Timer();
    timer.schedule(new java.util.TimerTask()
    public void run()
    timer.cancel(); //Terminate the timer thread
    destroy();
    , seconds * 1000);
    catch(MalformedURLException e)
    throw new RuntimeException(e);
    public void destroy()
    super.destroy();
    //close this window because we don't need it
    JSObject win = (JSObject)JSObject.getWindow(this);
    win.eval("window.opener=self;self.close();");
    If try to close without a timer my entier session gets killed, including my webstart app that the openAppServlet wrote out the jnlp for
    I hate this because it is not definite. I want to DEFINITELY know when my webstart app is open and I can close this original window. Like a whenWindowExists then close me but I have no clue how to do this.
    The "where_to_next" location is a servlet that will dynamically build a jnlp file specific for each web app building it from parameters in web.xml for each individual web app. Basically I will have to store the actual name of the class, the jar href's I will be needing, title, vendor, description, basically everything that can be different.
    So what I need is some kind of library so I can include it in multiple web apps EASILY. I don't want to have to write a document on how to include this thing. It should be self explainatory. I originally just mapped to the first servlet in my web.xml and then included the jar file but it appears to be non-existent in my project. Maybe some suggestions on what others would do may help me.
    Thanx in advance

    I don't want to use a timer because who knows if the servlet that writes out the dynamic jnlp will get hung up for a little while or any number of other reasons. If that did happen the timer would kick off and close my web start app. I cannot have this.

  • Open URL in current browser window

    I'm developing an application that works side-by-side with the user's default web browser. The browser communicates with the app through a proxy, and that works great. The issue I'm having is going the other way. So far, I've only been successful opening a new browser window each time. However, it would be much better to be able to open a page in the current window/tab. I mainly want this to work with Firefox (or anything other than IE). Has anyone ever done this, and is this even possible with Java?
    Thanks in advance.

    Desktop.getDesktop().browse() is what I'm using currently. I don't think you understood my problem. Currently it is opening in a new browser window. In Firefox, it's opening in a new tab, since I have it set to open in a new tab instead of new window. But, what I want it to do is open in the CURRENT tab. In other words, navigate from the current page to a new page, just as if the user had typed in an address into the address bar and pressed enter, or just as if he had clicked a standard link on the webpage.

  • Conditionally opening a new browser window from a JSP page

    When the user clicks on a button in my JSP page, I'd like to launch a new browser and display certain things in that browser window while leaving the original browser window open. The new browser should only be displayed if certain conditions are met.
    My thought was to invoke a javascript method in 'onLoad' which would determine if the new window needs to be launched.
    This is kinda what my page looks like:
    <jsp:root version="1.2" ................>
        <jsp:directive.page import="java.util.*, com.test.Configuration" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
         <ui:body binding="#{Page1.body1}" id="body1" onLoad="launchWindow();">     
         </ui:body>
       </f:view>
       <script type="text/javascript">
            function launchWindow(){
             if (Configuration.openWindow()) {
              window.open("hello.jsp", "newWindow", 'toolbar,width=400,height=400');            
        </script>     
    </jsp:root>
    My problem is that the call to "Configuration.openWindow()" does not resolve correctly. If I remove that call and simply make a call to "window.open()" all works. But once I put the condition in, nothing happens. I do not see an exception in my browser window but a new browser window does not open.
    Is my syntax correct. Can I make a call to the static method 'openWindow()' in my class 'Configuration.java'.
    I posted this same query on the JSF forum but received now replies. My question is more suited to the JSP forum and hence I'm posting this question here.
    thanks,
    tsc

    I have made some changes so that I do not directly access the 'Configuration' class in my javascript.
    I have a hidden field on my form and when the user clicks the button, in my back bean, I set a value for the hidden field. In the javascript function 'launchWindow()' I check if a value has been set for the hidden field and if yes, I open a new window.
    <ui:body binding="#{Page1.body1}" id="body1" onLoad="launchWindow(document.forms[0]);">
    <h:inputText id="hiddenField" value="#{formBean.hiddenValue}" />
    <script type="text/javascript">
            function launchWindow(form){
                alert("in lw");
                var test = form["form1:hiddenField"].value;
                alert("got test");
                if (test !=  "")
                    window.open("hello.jsp", "newWindow", 'toolbar,width=400,height=400');            
                alert ("done test");
    </script>When my page is first loaded, the launchWindow() is called and all the alerts popup as expected.
    When I click on the button (the back bean sets the value on the hidden field), my page is reloaded but this time its blank.
    Any ideas as to why this maybe the case?
    thanks,
    tsc

  • View requests result should open in new browser window

    Hello !
    I am new in OAF. And I am tired of looking forsolution...
    I have a requrement. In the "Request Monitor" page, requests result should open in a new window. It means that each user's click on "View request result" should open in a new browser window.
    I have found url like this in access.log:
    OA_CGI/FNDWRR.exe?temp_id=1069558080
    This url returned from package : fnd_webfile.get_url. And this package is used in about 30 java files...
    And I do not know which one of these files is used in my page...
    Finally, I want to add ' target="_blank" ' to result html code. Like this:
    Maybe It can be done a more simply way?
    Thank you!
    P.S. Here java files:
    Which one is used in "Monitor Request"???
    oracle\apps\az\util\CpLogViewUtil.java
    oracle\apps\fnd\cp\fileops\
    FileConstants.java
    FNDFSFileFetch.java
    oracle\apps\fnd\cp\request\
    RemoteFile.java
    oracle\apps\fnd\cp\util\
    RemoteFile.java
    oracle\apps\fnd\cp\viewreq\server\ViewRequestAMImpl.java
    oracle\apps\fnd\oam\bizexcep\handlers\
    BflowContextDetailsHandler
    oracle\apps\fnd\oam\bobj\activity\
    FRDLog.java
    oracle\apps\fnd\oam\bobj\adconfig\
    AppsCtxtCompFileList.java
    AppsCtxtFiles.java
    oracle\apps\fnd\oam\bobj\manager\crm\
    CRMProcessLog.java
    oracle\apps\fnd\oam\bobj\manager\views\
    ICMProcessLog.java
    ManagerProcessLog.java
    oracle\apps\fnd\oam\bobj\requests\views\
    RequestView.java
    oracle\apps\fnd\oam\cp\fileops\
    FileConstants.java
    FNDFSFileFetch.java
    oracle\apps\fnd\oam\launchMode\restricted\handlers\
    RestrModeHandler.java
    oracle\apps\fnd\oam\sdk\util\files\
    FNDFSUtil.java
    oracle\apps\fnd\oam\sdk\util\log\
    LogHandler.java
    oracle\apps\fnd\oam\sdk\util\support\
    AppsSignatureNode.java
    oracle\apps\fnd\oam\servlet\ui\handlers\activity\
    DatabaseSessionHandler.java
    FRDFilesListHandler.java
    FrmSessionHandler.java
    oracle\apps\fnd\oam\servlet\ui\handlers\adconfig\adv\
    AdvCfgNode.java
    oracle\apps\fnd\oam\servlet\ui\handlers\debugwb\
    SearchPGHandler.java
    oracle\apps\fnd\oam\servlet\ui\handlers\gsc\
    SvcCompDetailsHandler.java
    oracle\apps\fnd\oam\servlet\ui\handlers\request\
    CpRequestHandler.java
    oracle\apps\fnd\oam\servlet\ui\handlers\services\
    ServiceProcHandler.java
    ServiceStsHandler.java
    oracle\apps\fnd\wf\oam\bobj\util\
    WfQuery.java
    oracle\apps\fnd\wf\oam\handlers\
    WfComplWorkItemHandler.java
    Edited by: rsn on 01.12.2010 15:43
    Edited by: rsn on 01.12.2010 15:46
    Edited by: rsn on 13.05.2011 11:27

    Anand, thank You very much!
    "In your page, is "View request result" a link ?
    If yes then
    click on "Personalize Page" link which is at the top right corner of the page. Select "Complete View" radio button and click on "Expand All" link. Search for item "link". If your page has more than one link then choose the link item which is related to "View request result". Click on "Personalize" pencil icon corresponding to "link" item/region. Change the "Target Frame" property value to "_blank" under "Site" level. Click on "Apply" button.
    -Anand"
    This is a great power in "Personalize Page"!
    I make solution in this steps:
    1. Activate personalization to user, by setting profile "Yes" value on user level:
    Personalize Self-Service Defn / FND_CUSTOM_OA_DEFINTION
    2. Personalize 2 regions items (Image & Link)
    ( Don't ask me how !!! ;)
    Image have not Target Property. I move URI to Link Region Item and remove in step 4 from Image Region Item.
    3. Export page and my region
    java oracle.jrad.tools.xml.exporter.XMLExporter /oracle/apps/fnd/cp/viewreq/webui/CPViewRequestPG -rootdir $APPL_TOP/personalizations -username apps -password *** -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp) (host = localhost)(port = 1521)))(connect_data = (sid = prod)))"
    java oracle.jrad.tools.xml.exporter.XMLExporter /oracle/apps/fnd/cp/viewreq/webui/customizations/site/0/CPViewRequestPG -rootdir $APPL_TOP/personalizations -username apps -password ***-dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp) (host = localhost)(port = 1521)))(connect_data = (sid = prod)))"
    4. Modify in notepad /oracle/apps/fnd/cp/viewreq/webui/CPViewRequestPG.xml (remove URI from Image Region Item) from this file.
    5. Install script script for PROD like this:
    cp -R personalizations $APPL_TOP
    java oracle.jrad.tools.xml.importer.XMLImporter $APPL_TOP/personalizations/oracle/apps/fnd/cp/viewreq/webui/CPViewRequestPG.xml -username apps -password *** -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp) (host = localhost)(port = 1521)))(connect_data = (sid = prod)))" -rootdir $APPL_TOP/personalizations
    java oracle.jrad.tools.xml.importer.XMLImporter $APPL_TOP/personalizations/oracle/apps/fnd/cp/viewreq/webui/customizations/site/0/CPViewRequestPG.xml -username apps -password *** -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp) (host = localhost)(port = 1521)))(connect_data = (sid = prod)))" -rootdir $APPL_TOP/personalizations
    6. After install on PROD, You need to "bounce the apache". Additionally, it need to modify / upply button once on a region link. Right now I can not explain exactly, how it helps... But finnaly changes after 'XMLImporter' command will applyed after modify / upply manipulations.
    Edited by: rsn on 13.05.2011 11:16

Maybe you are looking for