Results 1 to 19 of 19
- 07-17-2010, 12:34 AM #1
Member
- Join Date
- Jul 2010
- Posts
- 4
- Rep Power
- 0
How to test if server is running Windows 7?
Hi, we have application that tests if a server is Windows 7. We currently do it by seeing if the following directory exists or not using the command below:
File f = new File(String.format("\\\\%s\\C$\\windows\\system32\ \tasks", hostName));
However, whenever this line runs, we get an exception saying the file can't be found. The file however can be accessed through Windows Explorer using command \\hostName\C$\windows\system32\tasks\
We all have local admin rights on the Windows 7 server machine as well.
So I'm wondering if there is a way to fix this issue or is there a better way to see if the server is running Windows 7 or not?
thanks!
- 07-17-2010, 01:20 AM #2
Have you looked at System Properties: os.name
- 07-18-2010, 01:10 AM #3
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
Norm is right.
You can simply watch your system with System.properties method
I recommend reading this Listing All System Properties | Example DepotIf my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 07-18-2010, 09:51 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 07-18-2010, 01:40 PM #5
What's a UNC name?
- 07-18-2010, 01:46 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 07-18-2010, 01:52 PM #7
Thanks.
My google came up with lots of University of North Carolina stuff.
- 07-18-2010, 02:52 PM #8
Also I didn't know that you could access a server using the File class.
What kind of server is that?
- 07-18-2010, 08:59 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 07-18-2010, 09:18 PM #10
So the connection is via some MS software. Is there any need for there to be a server on any of the PCs?
Last edited by Norm; 07-18-2010 at 09:21 PM.
- 07-18-2010, 09:33 PM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
Nope, not for UNC name resolution; shares are a MS thing that broadcast hosts all over the network, each machine is periodically yelling. Every other machine can use the shared partitions from that other host. The OP wants to (ab)use that feature to check whether or not a particular server runs on an MS Windows (7) machine.
kind regards,
Jos
- 07-19-2010, 04:45 PM #12
Member
- Join Date
- Jul 2010
- Posts
- 4
- Rep Power
- 0
Hi, thanks for the reply.
JosAh you are right, we are trying to abuse this particular feature to find out if the server is Windows 7 or not.
The complete URN string is \\v-server-01\C$\windows\system32\tasks\
I think it's becaues of the C$ that MS Windows don't like. We can access it via Windows Explorer but not from Java File object. Might be some MS Windows security related?
As for testing os.name, how would I do that for a remote server?
thanks.
- 07-19-2010, 04:48 PM #13
What type of server is it? What protocols does it support that you could use to ask it questions?
- 07-19-2010, 05:00 PM #14
Member
- Join Date
- Jul 2010
- Posts
- 4
- Rep Power
- 0
It's a Windows 7 server machine. I'm not sure what kind of protocol you are referring to?
- 07-19-2010, 05:24 PM #15
How do you use a server if there is no protocol for communicating with it?
Sample protocols: HTTP, FTP, SMTP
Can this server live outside of a MS environment?
How does java programming come into use here?
- 07-19-2010, 05:54 PM #16
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 07-20-2010, 09:23 AM #17
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
- 07-20-2010, 09:39 AM #18
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 07-21-2010, 01:37 AM #19
Member
- Join Date
- Jul 2010
- Posts
- 4
- Rep Power
- 0
Hi, thanks for the replies.
I found the problem yesterday which is that I need to give myself full access rights to the folder in question. I was told by network that we (the programmers) have full admin rights on the server but apparently we don't and that's what is causing the Java program to fail. Once I gave myself full control to the folder, the File object can access the directory properly using the \\server\C$\... notation. The Java exception path not found was throwing me off a bit as well.
thanks for all the replies and help.
Similar Threads
-
running java under Windows 7
By newbie123 in forum New To JavaReplies: 3Last Post: 05-29-2010, 08:36 PM -
Errors running app in linux but not in Windows
By JohnST in forum New To JavaReplies: 3Last Post: 03-12-2010, 01:58 AM -
how to keep server running
By Harris68 in forum NetworkingReplies: 4Last Post: 12-22-2009, 10:11 AM -
[SOLVED] TCP chat test availability server
By Koren3 in forum New To JavaReplies: 16Last Post: 05-02-2009, 12:55 PM -
Cannot choose runtime server, "Windows -> Preferences -> Server" does not exist!!
By TennSeven in forum EclipseReplies: 0Last Post: 09-18-2008, 05:07 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks