Solved

Show popup to specific Windows account

Posted on 2008-10-23
9
367 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 59

Expert Comment

by:Kevin Cross
Comment Utility
* thing of something
Should be " to think of something".
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:cdtcol
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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
Comment Utility
Ah, good luck with the client.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Have you considered what group policies are backwards and forwards compatible? Windows Active Directory servers and clients use group policy templates to deploy sets of policies within your domain. But, there is a catch to deploying policies. The…
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.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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:

744 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now