Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / May 2005

Tip: Looking for answers? Try searching our database.

Load default web browser

Thread view: 
smita bhopale - 18 May 2005 11:07 GMT
Hello,

I want to load a default web browser from my swing application [using
JApplet].

Using Runtime.getRuntime.exec("RunDLL 32.exe
shell32.dll,shellExec.RunDLL"+url);[for windows]
   default browser can be called.But it is working in normal class & with
frames only.
  with Applet  or in swing-JApplet
 it is showing error as :- java.security.AccessControlException:access
denied(java.io.FilePermission<<All FILES>>)execute>.

I want a plateform independent solution which will work in swing-JApplet.
Roland - 18 May 2005 17:30 GMT
> Hello,
>
[quoted text clipped - 10 lines]
>
> I want a plateform independent solution which will work in swing-JApplet.

Do you want to open a new browser window from within your applet? In
that case, use something like the following in your Applet (or JApplet):

URL url = new URL("http://java.sun.com/");
String targetWindow = "ArbitraryNameToIdentifyNewWindow";
AppletContext ctx = this.getAppletContext();
ctx.showDocument(url, targetWindow);

See:
<http://java.sun.com/j2se/1.4.2/docs/api/java/applet/Applet.html#getAppletContext()>
<http://java.sun.com/j2se/1.4.2/docs/api/java/applet/AppletContext.html#showDocum
ent(java.net.URL,%20java.lang.String
)>
Signature

Regards,

Roland de Ruiter
  ___      ___
 /__/ w_/ /__/
/  \ /_/ /  \

smita bhopale - 19 May 2005 10:08 GMT
If I am using browser to open my html file in which I have included the
<applet code=classfilename></applet>
then only showDocument will work.

If I try using appletviewer then it is not working.

I have just tried using following command-
Runtime.getRuntime().exec("cmd /c start "+url_in_string) ;
but I have to change the java.policy file & add permission like -
permission java.security.AllPermission;    
It is working in Japplet or Applet & using appletviewer also.

But I want plateform independent code .What can I do ?

I find WebBrowser.html from au.com.zip.cs package from google.
But I don't know wheather it will support the scripts,sound,flash or video
files .I have not found How to download the whole package & how to use it.

Is there any different solution for this problem?
smita bhopale - 19 May 2005 10:08 GMT
If I am using browser to open my html file in which I have included the
<applet code=classfilename></applet>
then only showDocument will work.

If I try using appletviewer then it is not working.

I have just tried using following command-
Runtime.getRuntime().exec("cmd /c start "+url_in_string) ;
but I have to change the java.policy file & add permission like -
permission java.security.AllPermission;    
It is working in Japplet or Applet & using appletviewer also.

But I want plateform independent code .What can I do ?

I find WebBrowser class from au.com.zip.cs package from google.
But I don't know wheather it will support the scripts,sound,flash or video
files .I have not found How to download the whole package & how to use it.

Is there any different solution for this problem?
Andrew Thompson - 19 May 2005 20:53 GMT
> I want to load a default web browser from my swing application

BrowserLauncher

>..[using JApplet].

An applet is not generally referred to as an application,
which in Java terms, would be a Frame/JFrame or non-GUI'd app.

For an applet(/JApplet), you can use showDocument() as suggested by Roland.

Only a signed applet could use BrowserLauncher, but using
showDocument makes more sense for an applet in any case.

HTH

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.