Sponsored Content
Top Forums Programming launching browser from Java on headless sever Post 302256717 by Solerous on Monday 10th of November 2008 11:46:51 AM
Old 11-10-2008
launching browser from Java on headless sever

I have a web based app that I need to launch from time to time using Java. The app only runs in a browser window so I need to get that running. I used OS X for my development and it runs fine on my laptop running the server on localhost. But when I deploy (in an oc4j container in a Solaris environment), the browser launch always fails. I think it is a DISPLAY issue but my UNIX is so rusty that I'm not confident about that. Here is the command I'm using to launch the browser in Java:

Code:
// my first attempt, commented out here but left for reference
// String cmd = "/opt/sfw/bin/firefox "+ url;

// my latest attempt
String cmd = "DISPLAY=:5 /opt/sfw/bin/firefox "+url+" -width 1600 -height 1200";

Runtime rt = Runtime.getRuntime();
Process p = rt.exec(cmd);

current error message looks like this:
Code:
08/11/10 11:28:41 
                           user dir:  /usr/local/src/oracle/product/10.1.3.2.0/OracleAS_1/j2ee/home
08/11/10 11:28:41 
                           command:  DISPLAY=:5 /opt/sfw/bin/firefox file:/var/tmp/DisplayURLs16188.html -width 1600 -height 1200
08/11/10 11:28:41 java.io.IOException: DISPLAY=:5: not found
08/11/10 11:28:41       at java.lang.UNIXProcess.forkAndExec(Native Method)
08/11/10 11:28:41       at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
08/11/10 11:28:41       at java.lang.ProcessImpl.start(ProcessImpl.java:65)
08/11/10 11:28:41       at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
08/11/10 11:28:41       at java.lang.Runtime.exec(Runtime.java:591)
08/11/10 11:28:41       at java.lang.Runtime.exec(Runtime.java:429)
08/11/10 11:28:41       at java.lang.Runtime.exec(Runtime.java:326)
08/11/10 11:28:41       at factory.BrowserLauncher.openURL(BrowserLauncher.java:116)

Thanks for any help you can offer!
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running a script on a different Sever

Guys, I want to run a script located on a different server from my pc. Let say the server has an IP of 1.1.10.2/16 and the script path is: /home/user/bin/check.sh The script scans for all available devices on the lan. My pc has an IP of 1.1.15.4/16 and I can ping the sever and can... (3 Replies)
Discussion started by: tony3101
3 Replies

2. AIX

find the IP's on the sever

Hi , I am working on AIx server which is connected to another network which is a stock market via leased line , From my side I connect to the server locally but what i need is to know the ip whic the server connect to the stock market how I can Know this ???? Thanks (1 Reply)
Discussion started by: habuzahra
1 Replies

3. UNIX and Linux Applications

Exceptions while running application on headless linux

I want to install executable file(Demo.bin) on vMA4.0 virtual machine using ssh. Same can be installed on all other Linux/Unix box. but when I am trying to run it on vMA,I am getting the following error-- Could you please advise me how to approch this problem and how to resolve it? (4 Replies)
Discussion started by: smartgupta
4 Replies

4. Ubuntu

The best distro to use on enviorment headless and only run scripts

Hello, I pretend create a machine headless for only run scripts! I think use Ubuntu Server, but this is the best option? Exist another system more light? Because the purpose is run script which do mathematical calculations. Sum, Division and Modules! My knowledge about word gnu/linux is on... (0 Replies)
Discussion started by: enodev
0 Replies

5. UNIX for Beginners Questions & Answers

Resolution Won't Change on Headless Linux Box?

Hello All, Wasn't sure if I was supposed to post this under Hardware so posting here... Device: CuBox-i OS: OpenSuSE 13.1 Uname: Linux CuBox-PC 3.14.14-cubox-i #1 SMP Sat Sep 13 03:48:24 UTC 2014 armv7l armv7l armv7l GNU/Linux Window Manager: XFCE Display Manager: lightdm (*XDM?) I... (2 Replies)
Discussion started by: mrm5102
2 Replies

6. UNIX for Advanced & Expert Users

LAMP Sever

How do I install a LAMP server on a new installation of Debian 9 using the lalest versions of AMP? Here is what I have. Corrections please. MYSQL apt-get install mysql-server mysql-client You can verify the MySQL server status using command: systemctl status mysql ------- PHP7... (0 Replies)
Discussion started by: Meow613
0 Replies
serialver(1)						      General Commands Manual						      serialver(1)

NAME
serialver - serial version command SYNOPSIS
serialver [ options ] [ classnames ] options Command-line options, as specified in this document. classnames One or more class names. DESCRIPTION
serialver returns the serialVersionUID for one or more classes in a form suitable for copying into an evolving class. When invoked with no arguments, it prints a usage line. OPTIONS
-classpath <directories and zip/jar files separated by:> Set search path for application classes and resources. -show Displays a simple user interface. Enter the full class name and press either the Enter key or the Show button to display the serialVersionUID. -Joption Pass option to the Java virtual machine, where option is one of the options described on the man page for the java applica- tion launcher, java(1). For example, -J-Xms48m sets the startup memory to 48 megabytes. It is a common convention for -J to pass options to the underlying virtual machine. SEE ALSO
See (or search java.sun.com) for the following: java.io.ObjectStreamClass @ http://java.sun.com/j2se/1.5/docs/api/java/io/ObjectStreamClass.html 24 June 2004 serialver(1)
All times are GMT -4. The time now is 09:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy