Hi, I am writing a java application that loads my website in a Safari JxBrowser component, unforunatly it wont work, this is the error I get
[CODE]
Exception in thread “main” com.teamdev.jxbrowser.UnsupportedBrowserTypeException: Safari engine doesn’t support current environment: Windows 7, 6.1, Service Pack 1, CPU arch: x86, Java Oracle Corporation 1.7.0_03, 32-bit
at com.teamdev.jxbrowser.BrowserFactory.createBrowser(Unknown Source)
at Main.main(Main.java:53)
(I have aso tried this with the x64 JDK, and still get the error)
This is the code I am using
[CODE]
import com.eaio.uuid.UUID;
import com.teamdev.jxbrowser.Browser;
import com.teamdev.jxbrowser.BrowserFactory;
import com.teamdev.jxbrowser.BrowserType;
import java.awt.BorderLayout;
import java.io.*;
import javax.swing.JFrame;
public class Main {
static public String getContents(File aFile) {
StringBuilder contents = new StringBuilder();
try {
BufferedReader input = new BufferedReader(new FileReader(aFile));
try {
String line;
while (( line = input.readLine()) != null){
contents.append(line);
}
}
finally {
input.close();
}
} catch (IOException ex){
}
return contents.toString();
}
static public void setContents(File aFile, String aContents) throws FileNotFoundException, IOException {
if (aFile == null) {
throw new IllegalArgumentException(“File should not be null.”);
}
if (!aFile.exists()) {
throw new FileNotFoundException (“File does not exist: ” + aFile);
}
if (!aFile.isFile()) {
throw new IllegalArgumentException(“Should not be a directory: ” + aFile);
}
if (!aFile.canWrite()) {
throw new IllegalArgumentException(“File cannot be written: ” + aFile);
}
Writer output = new BufferedWriter(new FileWriter(aFile));
try {
output.write( aContents );
}
finally {
output.close();
}
}
public static void main(String[] args) throws IOException {
Browser browser = BrowserFactory.createBrowser(BrowserType.Mozilla);
JFrame frame = new JFrame();
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(browser.getComponent(), BorderLayout.CENTER);
// frame.setUndecorated(true);
frame.setSize(800, 600);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
String uuid = “”;
UUID id = new UUID();
java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();
boolean mkdir = (new File(System.getenv(“APPDATA”) + “\.mysitedata”).mkdir());
if( mkdir ) {
String fileName = System.getenv(“APPDATA”) + “\.mysitedata\system.txt”;
File f = new File(fileName);
if(!f.exists()){
f.createNewFile();
setContents(f, “UUID: ” + id.toString() + “, PC_NAME: ” + localMachine.getHostName() + “, LOGGED_IN_USER: ” + System.getProperty(“user.name”) + “”);
uuid = id.toString();
}else{
String contents = getContents(f);
String[] parts = contents.split(“, “);
String[] UID = parts[0].split(“: “);
uuid = UID[1];
}
}
browser.navigate(“http://mysite.co.uk?access=app&uuid=” + uuid);
}
}
Also I can create the system.txt file in the correct location, but cannot seam to read it, any Ideas
Thank-you
Vinny