BookmarkSubscribeRSS Feed
Zelazny7
Fluorite | Level 6
Hello,

I am having difficulty launching a swing application (not an applet) from batch mode in a SAS data step. I am following the example found in the javaobj documentation here:

http://support.sas.com/rnd/base/datastep/dot/javaobj.html#oth

I have tested the application outside of SAS and it works as expected. I receive the following Java exception when running my data step:

java.awt.HeadlessException

A google search of this exception yields the following:

"Thrown when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse."

I can only assume that the batch environment somehow disables the input devices necessary for my swing application. Is there a way to enable input devices during batch execution? Has anyone successfully launched a swing application from SAS in batch mode?

Thank you much!
8 REPLIES 8
art297
Opal | Level 21
Zelazny,

Are you on 9.2? I haven't tried it but, from the description, it appears that you should be able to get around such issues:

http://support.sas.com/rnd/base/datastep/dot/javaobj.html#oth

Art
Cynthia_sas
SAS Super FREQ
Hi:
That link contains this statement (emphasis mine):

Here the colors class is instantiated (and the UI is displayed). Then we enter a loop which is terminated when the Quit button is pressed (this action is communicated to the DATA step via the done variable).


WHO is pressing the QUIT button and interacting with the UI when the program is submitted in batch mode??? Sometimes the assumption for batch mode (such as programs submitted by Enterprise Guide) is that the code will run on a server machine which does NOT have a display terminal.

Just curious... This actually sounds like a question for Tech Support to me.

cynthia
art297
Opal | Level 21
Cynthia,

You're probably correct, but one can always simulate pressing a button by simply sending some vb code.

Art
Cynthia_sas
SAS Super FREQ
If the VB code is going to simulate the QUIT button -- then I'm guessing that the VB will also have to simulate responding to the other UI buttons/choices in the app. In which case, I'm wondering what point there is in launching the UI app from a batch SAS program at all. If the VB code is going to answer all the prompts...then the VB code is just pretending to be a user??? I thought the point of having a UI (user interface) was that there would be a user to interface with the app.

cynthia
Zelazny7
Fluorite | Level 6
Thanks for your responses. I will submit my question to tech support. I believe all the examples with GUI's that I've come across are done in interactice mode. I can successfuly create and interact with java objects in batch mode only when they don't involve a GUI.
art297
Opal | Level 21
The following probably isn't relevant to the OP's question but, over the years, I have found UIs that already did something I wanted to accomplish in a batch job and pretending to be a user via VB was a lot easier than finding out how the code was written.

One such example was the display dde triplet UI. It provides an easy way to obtain a triplet, but wasn't built to complete the operation until the user clicks a button.

Art
Cynthia_sas
SAS Super FREQ
I'm convinced that everything old comes around again!

I used to write programs to simulate entering data into a CICS screen to update a file. (And if you don't know what CICS means, be thankful!)

cynthia
Zelazny7
Fluorite | Level 6
I just received a reply from SAS Technical. Unfortunately, batch mode disables keyboard, mouse and monitor so it is not possible to accomplish what I was hoping. Thanks again for your responses.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 930 views
  • 0 likes
  • 3 in conversation