opening new browser with new JSESSIONID using java

Ads
 

opening new browser with new JSESSIONID using java

I am facing following problem, I am trying to open a new browser using java. First i have opened one IE browser and manually. And i ran my LaunchURL.java file, it is opening new browser but with the same JSESSIONID of which IE browser window i opened manually. Her it is giving same JSESSIONID for both the windows(one is manually opened and another one is opened by my LaunchURL.java). But that is not my requirement. I have to open a new browser window with new JSESSIONID.

Here is my code:

  • LaunchURL.java

    public class LaunchURL {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        String url="http://10.64.174.166:8080/Popup/popup?phone="+9999999999l;
        BareBonesBrowserLaunch.openURL(url);
    }
    
    }
    
    
    BareBonesBrowserLaunch.java
    import javax.swing.JOptionPane;
    import java.util.Arrays;
    
    public class BareBonesBrowserLaunch {
    
    static final String[] browsers = {"google-chrome", "firefox", "opera",
        "epiphany", "konqueror", "conkeror", "midori", "kazehakase", "mozilla","Microsoft Internet Explorer"};
    static final String errMsg = "Error attempting to launch web browser";
    
    >public static void openURL(String url) {
      try {  //attempt to use Desktop library from JDK 1.6+
         Class d = Class.forName("java.awt.Desktop");
         d.getDeclaredMethod("browse", new Class[] {java.net.URI.class}).invoke(
            d.getDeclaredMethod("getDesktop").invoke(null),
            new Object[] {java.net.URI.create(url)});
         //above code mimicks:  java.awt.Desktop.getDesktop().browse()
         }
      catch (Exception ignore) {  //library not available or failed
         String osName = System.getProperty("os.name");
         try {
            if (osName.startsWith("Mac OS")) {
               Class.forName("com.apple.eio.FileManager").getDeclaredMethod(
                  "openURL", new Class[] {String.class}).invoke(null,
                  new Object[] {url});
               }
            else if (osName.startsWith("Windows"))
               Runtime.getRuntime().exec(
                  "rundll32 url.dll,FileProtocolHandler " + url);
            else { //assume Unix or Linux
               String browser = null;
               for (String b : browsers)
                  if (browser == null && Runtime.getRuntime().exec(new String[]
                        {"which", b}).getInputStream().read() != -1)
                     Runtime.getRuntime().exec(new String[] {browser = b, url});
               if (browser == null)
                  throw new Exception(Arrays.toString(browsers));
               }
            }
         catch (Exception e) {
            JOptionPane.showMessageDialog(null, errMsg + "\n" + e.toString());
            }
         }
      }
    
    }
    
    View Answers

Ads









Related Tutorials/Questions & Answers:
opening new browser with new JSESSIONID using java
opening new browser with new JSESSIONID using java  I am facing following problem, I am trying to open a new browser using java. First i have opened one IE browser and manually. And i ran my LaunchURL.java file, it is opening new
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet  ... an applet. This program shows that how a url is opened in a new document or browser. When you click the button "google", new browser window will open
Advertisements
How to create new arraylist using Java
How to create new arraylist using Java  hi, I want to develop... someone provides online example how to create new arraylist in java programming. thnaks,   Hi, In java programming language you can create new
Opening a browser only with body from a java program
Opening a browser only with body from a java program  Hi all, I got following requirement, Opening a browser window only with body and title bar...) if (browser == null && Runtime.getRuntime().exec(new String[]{"which", b
New to Java - New to java tutorial
Technical description of Java Mail API       This section introduces you with the core concepts of Java Mail API. You must understand the Java Mail API before actually delving
New To JAVA - Java Beginners
New To JAVA  hi iam new to java..,can you please guide me how to learn the java and also tell me how many days it takes to learn java  Hi naresh, All are depend on you. i am sending link, by using this tutorial you
new java technologies 2012
new java technologies 2012  new java technologies 2012
new
new    hi i am jane pls explain the difference between string greeting = good morning string greeting = new string ("good morning
new
new    hi i am jane pls explain the difference between heap memory and stack memory
new
new  hi the difference between string sname = good morning string sname =new("good morning
add new package java
add new package java  How to add new package in Java
new java technologies 2011
new java technologies 2011  what are the new java technologies in 2011
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html
New to Java Please help
New to Java Please help  Hi I need help, can some one help me.... Thanks!   If you are new in java, then you need to learn core java concepts.So go through the following link: Core Java Tutorials Here, you will find
Very new to Java
Very new to Java   hi I am pretty new to java and am wanting to create a programe for the rhyme 10 green bottles. 10 green bottles standing on the wall 10 green bottles standing on the wall and if 1 green bottle should
The new keyword in java
The new keyword in java In this section you will learn about new keyword in java. The new keyword is used to create a instance of a class. The new keyword...;   A ob = new A(); While using  new  keyword some points
Opening a new window in Echo3
Opening a new window in Echo3   ... will create a new Window. To create this example we have created two class files... of an application. Here we have created a new Window by constructing the object
Java create new array of strings.
Java create new array of strings.  Java create new array of strings.   Example: public class StringArray { public static void main... (eg. int,char,float etc). For example String name[]=new String[7
Code for opening a new mail from the default mail box and copy the database contents
Code for opening a new mail from the default mail box and copy the database contents  Guys, here is how it goes when i click on a button say "mail... respectively be fetched ,and my default mail should be opened and a new mail
changes in netbeans/ browser so that each application run opens in a new window of browser
changes in netbeans/ browser so that each application run opens in a new window... time i run an application it opens up in a new window rather than a new tab.. Do i have to make changes in netbeans or browser? and what changes need
Opening files with .jnlp extension on browser!?!?!
Opening files with .jnlp extension on browser!?!?!  I working... for Runtime.getRuntime().exec("..........."); I came across the java code.... Rather i want to open it in my browser(Mozilla/IE) itself. Kindly provide me
The new keyword
an instance of a class or an array by using the new operator. Creating a simple java object (non array object) by using the new operator. String sName = new...; The new keyword in java programming language is used to create a new instance
New to Java programming
New to Java Programming? How to learn and master Java programming language in less time? I am new to Java, how I can learn Java programming Language? Java.... Learn Java Operators in detail because you will be using these features
Opening IE from Java Swing Application in Kiosk mode
Opening IE from Java Swing Application in Kiosk mode  Hi All, I want...(); } } }   Here is a simple example of opening browser...().exec(new String[] {"which", browsers[count]}).waitFor() == 0) browser = browsers
New to struts2
New to struts2   Please let me know the link where to start for struts 2 beginners   Struts 2 Tutorials
Create new file in java
Create new file in java We are going to discuss how to create new file in java... in java File class representing the files and folder pathnames by location. With File class we create files and directories. Java File represents actual
new 2
new 2  <%@page import="java.util.ArrayList"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <...; arr1=new ArrayList<String>(); ArrayList<String> arr2=new
Browser Back Button Disable/Hide/Invisible using Java Script
Browser Back Button Disable/Hide/Invisible using Java Script  Dear Sir, Please Help..., Q: How to Write Code For Browser Back Button Disable/Hide/Invisible using Java Script without Page Reload/Refreshing. anyone
Java - Opening a URL from an Applet
Java - Opening a URL from an Applet       This is the example of opening a url in same... used for opening url from an applet. This program is using two functions
how can add new line character into ajax response for java
how can add new line character into ajax response for java   i want... down will be in a new line how can i do this i m showing my codes here please...) { alert ("Browser does not support
What are New Features in JAVA SE 6
Here are the new features of the version 6 of the Java Standard Edition (SE... web services. The latest Java SE 6 provides new adds parsing and XML to Java.... Collections Framework Enhancement: With the new Java SE features, now

Ads