This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to open internet explorer with desired site address..reply urgently

 
p sata
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


import java.awt.*;
import java.io.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.net.URL;
public class Try extends JPanel implements ActionListener
{
JButton jb1;
public static void main(String[] args)
{
JFrame frame= new JFrame("Pinal");
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.getContentPane().add(new Try(), BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
Try()
{
jb1 = new JButton("Click Me");
jb1.addActionListener(this);
add(jb1);
}


public void actionPerformed(ActionEvent e)
{

Runtime r = Runtime.getRuntime();
Process p = null;
try
{
//URL hp = new URL("http://www.yahoo.com");
p = r.exec("C:/Program Files/Internet Explorer/iexplore.exe");

}
catch (Exception ex)
{
System.out.println("Hello " + ex);
}
}

}



With above programm my explorer is opning... but not with url i specified...
This all requirment is for standalone application....
 
gautham kasinath
Ranch Hand
Posts: 583
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Well just chk the path u r giving ..

it works I tried just now..
Regds
Gautham Kasinath
 
p sata
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thanx things are working....

public void actionPerformed(ActionEvent e)
{

Runtime r = Runtime.getRuntime();
Process p = null;
try
{
String abc = "http://www.yahoo.com";
String ab = "C:/Program Files/Internet Explorer/iexplore.exe " + abc;
p = r.exec(ab);

}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic