PDA

View Full Version : Displaying image from IFS from AS/400



Guest.Visitor
01-01-1995, 02:00 AM
Does anyone have an example of executing a PC command from a java program running on the AS/400. We are trying to display a image that is stored in the IFS directory that is initiated from the AS/400.

Guest.Visitor
08-10-2000, 03:59 PM
Alan, What PC command you are trying to execute? Is that a web application? Can u give more details?? -Shams

Guest.Visitor
08-10-2000, 04:05 PM
Trying to execute Internet Explorer to display a gif from the IFS on the AS/400 and have it initiated on the AS/400. Example: IEXPLORE c:/SOS/SYSTEM/SOMEIMAGE.GIF

Guest.Visitor
08-10-2000, 07:34 PM
Hi Alan, There was an interesting discussion in mid-December in comp.lang.java.help about launching the default browser. But there is also a general answer to launching an executable as well as specific Java source code solutions to launching a browser to display a URL. FYI, I haven't done these, I'm just quoting. :) From Franck Allimant's WinHelp doc: http://www.confluent.fr/javadoc/indexe.htm java.lang Class Runtime java.lang.Object | +--java.lang.Runtime public class Runtime extends Object Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime method. An application cannot create its own instance of this class. Since: JDK1.0 See Also: getRuntime() From Roedy Green's Canadian Mind Products site: http://mindprod.com/jglosse.html exec Runtime.getRuntime().exec("myprog.exe") will spawn an external process that runs in parallel with the Java execution. You must use an explicit *.exe or *.com extension on the parameter. To run a *.BAT, *.CMD or *.BTM file, or to use the < > | piping options, you must spawn a command processor with the command file as an argument e.g. Runtime.getRuntime().exec( "command.com /E:1900 /C MyBat.bat" ); Runtime.getRuntime().exec( "cmd.exe /E:1900 /C MyCmd.cmd" ); Runtime.getRuntime().exec( "C:\4DOS601\4DOS.COM /E:1900 /C MyBtm.btm" ); Runtime.getRuntime().exec( "D:\4NT301\4NT.EXE /E:1900 /C MyBtm.btm" ); Similarly for Unix you must spawn the program that can process the script. exec returns a Process object that you can use to control, monitor or wait for the background process like this: /** * wrapper for Runtime.exec. * You will not see the console output of the spawned command. * @param command fully qualified *.exe or *.com command * @see exec, shell, command, cmd, forDOS, forNT */ public static Process exec (String command, boolean wait) { Process p; try { p = Runtime.getRuntime().exec(command); } catch ( IOException e ) { return null; } if ( wait ) { try { p.waitFor(); } catch ( InterruptedException e ) { } } // end if return p; } // end exec Process.getOutputStream lets you write out data that will be used as input to the process. Don't forget to include the "
" and "
" characters the process is expecting. Process.getInputStream lets you read in the data that your process squirted out to stdout. If you wait for the Process, you might want to do it on some thread other than the main AWT event processing one, i.e. create a new Thread, otherwise your app will not be able to process AWT events while you wait. --------------------------------------------------------------- I am quoting the entire glossary entry on exec from Roedy Green's site, http://mindprod.com/. The exec solution was noted on Usenet as an answer to launching a browser: Subject: Re: web pages from java Date: Wed, 15 Dec 1999 07:44:02 +1000 From: "David Crimmins" <dcrim@one.net.au> Newsgroups: comp.lang.java.help exec("start www.mypage.com"); this will launch default browser from windows platform, not sure about mac or unix <missa1@my-deja.com> wrote in message news:8355l9$q3l$1@nnrp1.deja.com... <blockquote><tt> How can I call up web pages from a java application? Thanks, Missa. </tt></blockquote> But a Java source code solution for launching a browser was also pointed out: Subject: Re: web pages from java Date: 12/18/1999 Author: Kerry Beier <kbeier@SPAMBLOCK.uq.net.au> On Tue, 14 Dec 1999 10:20:26 GMT, missa1@my-deja.com wrote: >How can I call up web pages from a java application? >Thanks, >Missa. Missa, There is a great class called BrowserLauncher at http://www.stanford.edu/~ejalbert/software/BrowserLauncher/ It will allow your java application to launch a url in the user's default web browser regardless of what platform your application is running on. The source code for this class is very useful to read too. Kerry I have the source, and this is the introduction: /** * BrowserLauncher is a class that provides one static method, openURL, which opens the default web browser for the current user of the system to the given URL. It may support other protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously tested and is not guaranteed to work. * Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms that are not part of the standard JDK. What we're trying to do, though, is to take something that's frequently desirable but inherently platform-specific -- opening a default browser -- and allow programmers (you, for example) to do so without worrying about dropping into native code or doing anything else similarly evil. * Anyway, this code is completely in Java and will run on all JDK 1.1-compliant systems without modification or a need for additional libraries. All classes that are required on certain platforms to allow this to run are dynamically loaded at runtime via reflection and, if not found, will not cause this to do anything other than returning an error when opening the browser. * There are certain system requirements for this class, as it's running through Runtime.exec(), which is Java's way of making a native system call. Currently, this requires that a Macintosh have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops back from the inherently platform-sensitive concept of a default browser and simply attempts to launch Netscape via a shell command. And goes on with a copyright notice and credits. It is one 18K source file. It is also used in the com.chez.powerteam.jext open source Java text editor. HTH, Ralph

Guest.Visitor
08-11-2000, 03:24 AM
Have you tried Ultimedia APIs? Dave

Guest.Visitor
08-11-2000, 12:33 PM
Alan, <h1> HOPE THIS WORKS </h1> <h6> The gif file is in the folder SHAMS, next to the root directory</h6> /SHAMS/dsd_90w.gif is this what u expect? -shams