Solved

how to list and map network printer in Active Directory using java

Posted on 2011-02-27
13
804 Views
Last Modified: 2013-11-24
hi,

is that possible to list network printers in AD and connect it to local machine when a button clicked?
I am wondering if this could be done in java. and if yes, can you please give me some ideas?

thanks
0
Comment
Question by:Ikelca
  • 6
  • 4
13 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 34993879
You can use Runtime.getRuntime.exec("net  view \\\\print_server_name");
0
 
LVL 47

Accepted Solution

by:
for_yan earned 334 total points
ID: 34993888

You can check this page which talks about it:

http://www.thatsjava.com/java-essentials/2240/

Then you need to capture output and anlyze it

Connect to local machine - that's next step you can do in the same
way using command
Runtime.getRuntime().exec("net use lpt: \\\\server_name\\printer")
0
 

Author Comment

by:Ikelca
ID: 34993945
it seems that link has no answers either, net view or net use commands are OS dependent.  
im wondering if there is any API that we can use.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993963


Java printing API does have a part which is called Printer discovery - maybe it will help:
http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993971

Stiil, I think in this API it will discover only local printer
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Ikelca
ID: 34994005
so i guess there is no way to implement this idea in java ?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34994026
Well, never say never, maybe someone will still come up with some idea
Probably, for now if you just check the system and do some system specific discovery - maybe it is more practical
0
 

Author Comment

by:Ikelca
ID: 35019853
it seems only you and me here lol~~
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 334 total points
ID: 35020156
I guess you can RequestAttention.
Because once the question is a little bit old - and only those who chimed in before are
by default informed about, say, your additinal posting to it, so probability
someone else to rememeber is quite low.
I'm not sure,  as I'm rather new here myself,
but I think Request Attention may help to get more folks reminded
0
 
LVL 15

Assisted Solution

by:pcsmitpra
pcsmitpra earned 166 total points
ID: 35181803
Please view here , a similar script was discussed.
0
 

Author Closing Comment

by:Ikelca
ID: 35341462
cant find working solution, decided to go with c# instead of java
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Resolve DNS query failed errors for Exchange
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:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

706 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

21 Experts available now in Live!

Get 1:1 Help Now