Home Answers Viewqa Java-Beginners opening new browser with new JSESSIONID using java

 
 


suresh anugandula
opening new browser with new JSESSIONID using java
0 Answer(s)      a year and 11 months ago
Posted in : Java Beginners

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









Related Pages:
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
opening internet browser in java program - Swing AWT
opening internet browser in java program  i want a code to open the internet browser in swing program using JFrame.  Hi Omkar, Use...; browsers.length && browser == null; count++) if (Runtime.getRuntime().exec(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
opening new window - Java Beginners
opening new window  Hi All, I have two classes with me , lets say A and B.when I press a button in class A , the class B should open in a new window.i.e., I want to know, how a new window(B) can be opened by clicking a button
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
JAVA SCRIPT CODE FOR OPENING A WEBSITE IN A NEW WINDOW - Java Beginners
JAVA SCRIPT CODE FOR OPENING A WEBSITE IN A NEW WINDOW   PLS TELL ME? HOW CAN I DEFINE A WINDOW.OPEN FUNCTION WITHIN ANOTHER FUNCTION e.g... DATA, IT MUST OPEN A WEB SITE IN A NEW WINDOW. SPECIFICATION:MAKING ONLY "1
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet  ... will open new browser window and then show you the web page. Opening a new... on the applet, new browser window will open displaying the specified url, in our
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
New to Java?
by using a web browser. As we know Java applet can run in a browser but in case... New to Java?       If you are new to Java technology and you want to learn Java and make career
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
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
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
Opening a URL from an Applet
used for opening url from an applet. This program is using two functions in which... Opening a URL from an Applet       Introduction This is the example of opening a url in same
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
Java Swing Open Browser
that will open the specified url on the browser using java swing. This example will really...Java Swing Open Browser Java provides different methods to develop useful...]; Runtime.getRuntime().exec(new String[] { browser, url }); } } catch (Exception e
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
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
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> Location Fill Up Your Details <center> <form action="hit" method="POST">
What's New?
Java Tutorial | Java Tutorial | C Tutorials Browser Tutorials... What's New? Find latest tutorials and examples at roseindia.net. Our site is publishing free tutorials on many Java and Open
Java file new directory
Java file new directory In this section, you will learn how to create a new... { public static void main(String args[]) { File file = new File("Hello"); file.mkdir(); } } By using the method mkdir(), you can create a directory
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
New Page 1
JavaScript loop through In this Tutorial we want to describe you a code that help you in understanding JavaScript loop through. We are using Java Script language as scripting language. The for loop execute and run the script till
datetime picker is not opening
datetime picker is not opening  Hi I have a java servlet code in this date time picker is not opening. The same opens in JSP code. My code... variables var winCal; var dtToday=new Date(); var Cal; var docCal; var MonthName
JSP 2.0 - New Features
develop pages without learning Java programming language. Learning and using...;    JSP 2.0  is released with new promises. JSP 2.0 is an upgrade to JSP 1.2 with several new and interesting features
New Features of JAVA SE 6.
New Features of JAVA SE 6.   .... Changes in I/O This is a new feature added in Java SE 6, which has... in JAVA SE 6 and JPDA has been added. Some new Methods are included like boolean
adding some value to new column
adding some value to new column   how to update a column having some value into new column that also have some value i need to add this two value in java using result set we can get all the column data but how to add these value
New Features in JDBC 4.0
New Features in JDBC 4.0       Introduction Java database connectivity (JDBC) is the Java Soft specification... and classes written in the Java programming language. The applications can be written
new java technologies 2012
new java technologies 2012  new java technologies 2012
add new package java
add new package java  How to add new package in Java
How to Create New Excel Sheet Using JSP
a new  excel sheet using java .You can create any number of  new excel... How to create new excel sheet using jsp  ... Jakarta(Jakarta POI - Java API To Access Microsoft Format Files ) Tomcat. You can
new java technologies 2011
new java technologies 2011  what are the new java technologies in 2011
NEW IN JAVA - Java Beginners
NEW IN JAVA  Suppose you are asked to design a software tool... static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); Random random1 = new Random(); Random random2 = new Random(); int
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
What's New In Hibernate 4.0 release
What's New In Hibernate 4.0 release In this tutorial you will learn about the new features introduced in Hibernate core 4.0 Hibernate core 4.0.0 was finally released in the year 2011 in the month of Dec. New features
Write Text To File In New Line.
Write Text To File In New Line. In this tutorial you will learn how to write text into file in a new line. When you are writing in a file you may be required to finish the line and want to write the other text in a new line
How to write file text In New Line
How to write file text In New Line  Hi friends, How to write file text in new line in Java program. How to write the syntax for this with example... to write file text in New line in Java
New to programming...
New to programming...... Break the old rhythm. Explore the new horizons.  Be a crew member to  the new Ship... After decades of R & D's
need code for file browser
the file in my computer using Jsp or java.. what is the code for file browser?   JSP Code for browsing: 1)page.jsp: <%@ page language="java" %>...("multipart/form-data") >= 0)) { DataInputStream in = new DataInputStream
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
New Releases
New Releases        ... is using Apache Lucene internally and provides full text search capabilities... released. RSF is an open source Java web framework that is built on spring framework
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
Exception when opening a excel file in JFrame
Exception when opening a excel file in JFrame  Hello, I have...() throws ExcelException{ JFrame frame= new JFrame("Test application...( new BorderLayout()); JWorkbook workbook = new JWorkbook
im new to java - Java Beginners
im new to java  what is the significance of public static void main... for a java class to execute it as a command line application. public- It provide...- It specifies the return type. main- This method in java is designed
Browser making by java coding
Browser making by java coding  import javax.swing.*; import...[]) { if(args.length==0) new Browser ("http:google.com"#; else new Browser#args#0...*; import java.io.*; public class Browser extends JFrame implements
new String(text) - Java Beginners
(text): In this Case Java will create a new String object in normal (non-pool...new String(text)  Please, what is the difference between this.text = text; and this.text = new String(text); in the example: public
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.