Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 4, 2006, 02:53 AM   #1
VegetaPunk
macrumors 6502
 
Join Date: Dec 2002
Location: AZ
Java - Launch html Document

Im using JBuilder to make a java application.
In this application I want to add a help button that when you press it launches a help.html document, that I have made, using the systems defualt browser. How do I launch a document in java?
VegetaPunk is offline   0 Reply With Quote
Old Feb 4, 2006, 05:13 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
I don't think it's possible in pure java as the method for doing that will be OS dependant. On OSX you would do it via NSWorkspace using the openURL method. You will need to look at other solutions for other platforms.
robbieduncan is offline   0 Reply With Quote
Old Feb 4, 2006, 05:49 AM   #3
iJed
macrumors 6502
 
Join Date: Sep 2001
Location: West Sussex, UK
Quote:
Originally Posted by VegetaPunk
Im using JBuilder to make a java application.
In this application I want to add a help button that when you press it launches a help.html document, that I have made, using the systems defualt browser. How do I launch a document in java?
I believe you could use Runtime.exec("/usr/bin/open " + filePath).

You may not need to use the open command but I'm not sure as I've never tried this before. Also remember that open is Mac OS X specific so it will not be a good cross platform solution.
iJed is offline   0 Reply With Quote
Old Feb 4, 2006, 10:00 AM   #4
gekko513
macrumors 601
 
gekko513's Avatar
 
Join Date: Oct 2003
Quote:
Originally Posted by VegetaPunk
Im using JBuilder to make a java application.
In this application I want to add a help button that when you press it launches a help.html document, that I have made, using the systems defualt browser. How do I launch a document in java?
This piece of code looks very promising. (The web designer's sense of usability/readability isn't quite as promising.)
gekko513 is offline   0 Reply With Quote
Old Feb 5, 2006, 12:32 AM   #5
ryan
macrumors 6502
 
Join Date: May 2002
Location: Denver, CO
Send a message via AIM to ryan Send a message via MSN to ryan Send a message via Yahoo to ryan
Depending on the complexity of the HTML you're looking to display I'd recommend looking at Java's JEditorPane.
ryan is offline   0 Reply With Quote
Old Feb 5, 2006, 12:42 AM   #6
jalagl
macrumors 6502a
 
jalagl's Avatar
 
Join Date: Jun 2003
Location: Costa Rica
Send a message via ICQ to jalagl
Quote:
Originally Posted by iJed
I believe you could use Runtime.exec("/usr/bin/open " + filePath).

You may not need to use the open command but I'm not sure as I've never tried this before. Also remember that open is Mac OS X specific so it will not be a good cross platform solution.
I've used this before on Windows, and it launches the default browser (it is the same functionality as if you double-clicked the html file.
jalagl is offline   0 Reply With Quote
Old Feb 6, 2006, 05:10 PM   #7
VegetaPunk
Thread Starter
macrumors 6502
 
Join Date: Dec 2002
Location: AZ
TY for all the help guys!
I used the runtime and it works on the mac now I just need to test it on my pc! thanks again!
VegetaPunk is offline   0 Reply With Quote
Old Feb 6, 2006, 05:32 PM   #8
VegetaPunk
Thread Starter
macrumors 6502
 
Join Date: Dec 2002
Location: AZ
=( it didnt work with windows is there another path I need to use besides "/usr/bin/open" ?

thanks in advance
VegetaPunk is offline   0 Reply With Quote
Old Feb 6, 2006, 05:43 PM   #9
VegetaPunk
Thread Starter
macrumors 6502
 
Join Date: Dec 2002
Location: AZ
"cmd /c" worked for me (using win2k) =)
VegetaPunk is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Force desktop html shortcut to launch in Firefox? mgmusicman94 OS X 5 Mar 15, 2014 08:29 PM
Adobe Contribute CS4 crashes on launch: "No Document Types have been found" atlanticza Mac Applications and Mac App Store 13 Jan 31, 2013 08:55 AM
How to parse html page including java script? mikezang iPhone/iPad Programming 5 Dec 4, 2012 07:16 AM

Forum Jump

All times are GMT -5. The time now is 07:12 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC