Home Answers Viewqa Java-Beginners Opening IE from Java Swing Application in Kiosk mode

 
 


Abhijith S
Opening IE from Java Swing Application in Kiosk mode
3 Answer(s)      6 months and 12 days ago
Posted in : Java Beginners

Hi All, I want to open a URL in IE from my Java Swing application running in Wiindows. I am using the below code.

public static boolean openInBrowserKioskMode(String url){
 String os = System.getProperty("os.name").toLowerCase();
 Runtime rt = Runtime.getRuntime();
 try{
    if (os.indexOf( "win" ) >= 0) {
        rt.exec( "rundll32 url.dll,FileProtocolHandler " + url);
}
 }catch (IOException e){
e.printStackTrace();
    return false;
 }
 return true;
}

As per the above code, IE window is opening. But I want to open the IE window in Kiosk mode or without address bar, foward/back buttons, etc. Please help me to resolve this problem

Thanks & Regards, Abhijith

View Answers

November 7, 2012 at 3:41 PM


Here is a simple example of opening IE in swing application.

class OpenBrowser 
{
    public static void main(String[] args) 
    {
          String browserPath = "C:/Program Files/Internet Explorer/IEXPLORE.EXE"; 
          String url = "www.roseindia.net";
          try {
               String[] b = {browserPath, url};
               Runtime.getRuntime().exec(b);
           }
           catch (Exception exc) {
        exc.printStackTrace();
           }
    }
}

November 7, 2012 at 3:42 PM


Here is a simple example of opening browser in swing application.

1)OpenBrowser.java

import javax.swing.*;
import java.lang.reflect.Method;

public class OpenBrowser {
public static void openURL(String url) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Windows"))
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
else {
String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
browser = browsers[count];
Runtime.getRuntime().exec(new String[] {browser, url});
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error in opening browser" + ":\n" + e.getLocalizedMessage());
}
}
}

2)Browser.java

import javax.swing.*;
import java.awt.event.*;

public class Browser {
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
final JTextField url =new JTextField(20);
JButton button = new JButton("Open Browser");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
OpenBrowser.openURL(url.getText().trim());
 }
});
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.add(new JLabel("URL:"));
panel.add(url);
panel.add(button);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
}

November 7, 2012 at 3:42 PM


Here is a simple example of opening browser in swing application.

1)OpenBrowser.java

import javax.swing.*;
import java.lang.reflect.Method;

public class OpenBrowser {
public static void openURL(String url) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Windows"))
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
else {
String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
browser = browsers[count];
Runtime.getRuntime().exec(new String[] {browser, url});
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error in opening browser" + ":\n" + e.getLocalizedMessage());
}
}
}

2)Browser.java

import javax.swing.*;
import java.awt.event.*;

public class Browser {
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
final JTextField url =new JTextField(20);
JButton button = new JButton("Open Browser");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
OpenBrowser.openURL(url.getText().trim());
 }
});
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.add(new JLabel("URL:"));
panel.add(url);
panel.add(button);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
}









Related Pages:
Opening IE from Java Swing Application in Kiosk mode
Opening IE from Java Swing Application in Kiosk mode  Hi All, I want to open a URL in IE from my Java Swing application running in Wiindows. I am... window is opening. But I want to open the IE window in Kiosk mode or without address
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... { //attempt to use Desktop library from JDK 1.6+ Class<?> d = Class.forName
catching tomcat object to swing application
catching tomcat object to swing application  Hi, I have 2 java projects, one is running on tomcat server and another is at client pc ie swing application. So I need to catch a server side object from swing application. How can I
Opening Notepad
Opening Notepad  Sir/madam I want to open notepad from java applications and save the contents on it. Can someone please help me to do...}; Runtime.getRuntime().exec(commands); }   Java Create
Excel sheet in read only mode - WebSevices
Excel sheet in read only mode  If am opening an excel sheet(through web application) to edit any information,Its opening in read-only mode... to open in read and write mode so that user can edit it. I am using Java
How to launch my web application from my desktop without opening Netbeans IDE everytime i run the application?
How to launch my web application from my desktop without opening Netbeans IDE... dont want all these steps, so i knw that java application can be launched using Java Web Start but dont knw abt web application, Is there any way to do
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...) { JOptionPane.showMessageDialog(null, "Error in opening browser" + ":\n" + e.getLocalizedMessage
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
Launch of Toolbar in IE - WebSevices
Launch of Toolbar in IE  "I have created a toolbar with Java Swing I would like to know the steps about how to launch the toolbar in IE
How to run java swing application from jar files .
How to run java swing application from jar files .  Hello Sir, I developed a java swing application .Now i want to execute it as .exe... the main class program will exit" from "java virtual machine". Plz help me
Swing Application
Swing Application  hello, i am making swing application in java i am unable to run prog......when my rite clikcing on my project name and clicking thn run it is not showing output .....and when i am cliking on individual java
swing application to import a object in a excel
swing application to import a object in a excel  Hi sir, I want to make a swing application where I can import a object in a cell of a excel... 'create from file' window>browse (this browse path I want to give inside the swing
problem in swing program for opening two windows with same login credentials
problem in swing program for opening two windows with same login credentials  I Face two problems while writing the code in swing program 1.i developed one application using swings that has username,password when i login
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
swing
swing  Write a java swing program to delete a selected record from a table
iPhone landscape mode
and you will find that your iphone application is opening in landscape mode... iPhone landscape mode In this series of iPhone application development tutorial, you'll learn launching your iPhone app in landscape mode. Believe me
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
Error Opening File - Java Interview Questions
Error Opening File  Dear, Please if help me to resolve this problem. I have an application in java that works correctly under Eclipse... this generated file, a message was displayed: Error opening file. But If I
open a bufferedwriter file in append mode - Java Beginners
to opena bufferedwriter file in append mode..  Hi friend, FileWriter...) then the constructor append the specified data to the file i.e. the pre-exist data...://www.roseindia.net/java/example/java/io/java-append-to-file.shtml Thanks
swing
swing  i wanted to create a gui desktop application .that can take the database name and mysql password from text box, and after the click of a button it should show connection status,and go for next from there on button click
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet       This is the example of opening a url from an applet. This program shows that how a url is opened in a new document or browser
Changing Look and Feel of Swing Application
and feel for your Swing Application. The look and feel feature of Java Swing provides more interactivity of the frame for user application. Swing allows... Changing Look and Feel of Swing Application  
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
Threads in Java Swing MVC Application
Threads in Java Swing MVC Application  Hello, I am currently making a Java Swing application, but I am having a lot of trouble with implementing threads into my program. I use the MVC paradigm and I just can't seem to implement
Java Swing Tutorials
anything from user. Java Swing provides the facility to input any thing...() method of the Java Swing.   Copy data from one JTextField... is a component of GUI.   Chess Application In Java Swing In the given
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... (jniwrap.dll) in java.library.path: C:\Program Files\Java\jdk1.7.0_05\bin;C
Sitemap Java Swing Tutorial
Dialog Box Application in Java Swing | Show Message and Confirm Dialog Box... using Swing | Chess Application In Java Swing Jboss 3.0 Tutorial Section 10...-to-One Relationship | JPA-QL Queries Java Swing Tutorial Section
Retrieve data from database in swing application
Retrieve data from database in swing application  I want to retrive data(doctor name,specilization,date) from my sql database...(); ResultSet rs=st.executeQuery("select * from data where id=1"); while
Date picker in Java Swing
thoroughly . But Sir, I want Time Picker In java swing desktop application..., I want Time Picker In java swing desktop application. In time picker we can... in need of Time Picker just like the Date picker available in java Swing. Kindly
What is Java Swing?
What is Java Swing?       Here, you will know about the Java swing. The Java Swing provides... and GUIs components. All Java Swing classes imports form the import
java swing.
java swing.  Hi How SetBounds is used in java programs.The values in the setBounds refer to what? ie for example setBounds(30,30,30,30) and in that the four 30's refer to what
java swing - Swing AWT
java swing   Iam developing a java web browser.Actually my code works fine ie. i can load a web page without proxy.But in my place i have only proxy... a proxy or how to make my java web browser to listen to proxy setting??? please help
Opening a URL from an Applet
Opening a URL from an Applet       Introduction This is the example of opening a url in same... used for opening url from an applet. This program is using two functions in which
Java swing
Java swing  Write a java swing program to calculate the age from given date of birth
Java - Swing AWT
Java  How can I run an application of Microsoft Windows like notepad or paint from my swing program?  Hi friend, import java.awt..... http://www.roseindia.net/java/example/java/swing
swing - Java Beginners
Swing application testing  What are the conventions for testing a Java swing application
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am... that are in the excel file (like extracting the questions from the excel file
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am... that are in the excel file (like extracting the questions from the excel file
How to link an excel file with the application software using java swing
How to link an excel file with the application software using java swing  I have to link an excel file with a application software which I am... that are in the excel file (like extracting the questions from the excel file
Swing application
Swing application  Hello, I want to develop a Swing application... the application not through web browsers, instead through a Swing desktop application GUIs. Please help me to develop such an application
Java question - Swing AWT
Java question  I want to create two JTable in a frame. The data in one JTable will be shown as a result of a query i.e. the data in a resultset. This query is fixed. This query is "select * from item". Item table has following
Query on Java Swing - Table Cell Issue - Swing AWT
Query on Java Swing - Table Cell Issue  Hi, I have a query on Java Swing. we are using swing in our application, In one of the frame we are using JTable which has 6 columns which are editable. When I use the TAB button from
java - Swing AWT
java  yes,i want to link one GUI application to another;such that i... = st.executeQuery("SELECT * FROM login where username='"+value1+"' && password... have linked Login Application with Registration Application by instantiating
Swing Program
Swing Program  Write a java swing program to calculate the age from given date of birth
Mean, Median and Mode - Java Beginners
Mean, Median and Mode  Write a java program that computes three measures of central tendency of a given set of students marks: mean, median, and mode...); System.out.println("Median= "+median); int mode=Find.findMode(ranNum
Create toolbars for IE
Create toolbars for IE  how to create a ie toolbar in java script
html parsing in java and display in swing
html parsing in java and display in swing  dear rose indians I am working on a swing application (Content Management System). In which i have to show HMTL pages in swing window forms to display html contents i am using
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 is: **function.js** <script language="javascript" type="text/javascript" src

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.