Solved

Show popup to specific Windows account

Posted on 2008-10-23
9
372 Views
Last Modified: 2013-12-05
Hello all,

I have developed a Java server-application... it is always listening to a port and when another application hits that port, my application prompts a JFrame (popup).

The problem we are having now is with Windows 2003 Terminal Server. If I start running my Java-server application using Administrator (Windows account) my Java-server application will always show the popup to Administrator user. If I use other Windows account (e.g. student) while my application is still running under Administrator Windows account, the popup window stills displaying at the Administrator user account.

I need the popup on the correct Windows account. The Java-server application (which shows the popup) knows which Windows user needs to receive the popup. But if it is running under Administrator, it will always display it to Administrator account and not to the one that needs to receive the popup.

I have tried running my Java-server application under SYSTEM account and still does not work.

How can I display that popup to that specific Windows account ?

Thank you very much.
0
Comment
Question by:cdtcol
  • 5
  • 4
9 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22827431
How are you getting which user is logged in currently?

System.getProperty("user.name");

Should get you value of the windows logon, but maybe this is what you are using already.
0
 

Author Comment

by:cdtcol
ID: 22831488
Thank you mwvisa1 for your interest.

My Java-server application waits in a port. Another application hits that port (at any time) and that second application is the one that send me the information about which Windows account I must show the popup. My Java-server application receives that info and shows the popup.

The problem is that the popup is shown where the Java-server application was first executed.. not the desired Windows account.
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22832893
So the problem is (paraphrasing to ensure my understanding):

SourceApp --> tcpip/socket connection --> ServerApp --> tcpip/socket connection --> Client (ClientApp)

What you are getting is that the response is being sent on the originating tcpip connection when what you need to do is start a whole new tcpip/socket connection to send a message to Client (not sure you are using socket connections here -- just using as reference of where the flow of communication is).

The problem there is the server app must know how to connect to this new connection.  Since it is sounds like it is the same machine, you could try to use a mechanism like windows sendmsg to user name you get from source application.  You could execute something like that through Runtime.exec.

Am I close to what you are looking for?  I am not sure myself how I would implement that, but maybe the confirmation of this will help another expert happening by thing of something.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22832909
* thing of something
Should be " to think of something".
0
 

Author Comment

by:cdtcol
ID: 22833524
Thank you again mwvisa1.

App1 --> socket --> Server App

Server App receives data from App1 and shows a popup.

The sendmsg to a user could be, but I my Server App displays more than a message.. it is a custom popup.. it shows some info and asks for more information from user and sends an OK or a Cancel.

Is there a way, using Java, to display that popup to a desired Windows Account ?

If not, I will have to keep my Server App and probably develop some Client App that must be executed by each Windows Account in order to keep that socket open and my Server App will hit the one it needs to display the popup.
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 22835630
If you have a client app, my original code may work but not sure in this scenario.  The idea was you have a value coming to server app that says user "BobSmith".

If code, you can do this:

String messageUser = "BobSmith";
String currentUser = System.getProperty("user.name");

if (currentUser.equalsIgnoreCase(messageUser) {
    JOptionPane.showMessageDialog(null, "My custom message");
}
0
 

Author Comment

by:cdtcol
ID: 22844699

System.getProperty("user.name") is always returning "Administrator", which is the user that runs my Java-server application.

Thank you very much for your help... I have decided developing a Client app and will take in count your last code.

Thank you.

0
 

Author Closing Comment

by:cdtcol
ID: 31509326
Thank you very much for your help... I have decided developing a Client app and will take in count your last code. I am really sure it will work.

Thank you.
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22845289
Ah, good luck with the client.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 53
Application launch issue with Apache Tomcat 5 45
servlet requestdispatcher include and forward differences 1 31
hibernate jars 4 30
Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question