WORKGROUP

N

Nigel Wade

WORKGROUP - it is the network workgroup in which the computer is set.

and if the computer is not in a WORKGROUP, what would you expect to happen?

To give you some kind of clue, Java is cross-platform.
 
I

Ilya Lakhmitski

If the computer is not in a WORKGROUP, the value can be NULL. it is
ok.

The question is not what happens if something will occur, but how to
get the name of WORKGROUP using java for different operation systems.
 
N

Nigel Wade

If the computer is not in a WORKGROUP, the value can be NULL. it is
ok.

The question is not what happens if something will occur, but how to
get the name of WORKGROUP using java for different operation systems.

There is no concept of "WORKGROUP" in different operating systems. It is
entirely a Microsoft Windows concept only. Not even all Windows machines
belong to a WORKGROUP.

If you are developing cross-platform software it can't be required. If
it is required then the software will only work on Windows, and you need
to ask yourself whether a language which has direct access to
Windows-only features might be more appropriate. That is what my clue
was alluding to.
 
R

Roedy Green

Is there a way to get the name of WORKGROUP in java?

Java is WORA. Workgroup is specific to Windows so you won't find
anything in the official Java to find it out. You would have to use
JNI or exec something to find it out.

See http://mindprod.com/jgloss/jni.html
http://mindprod.com/jgloss/exec.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
For me, the appeal of computer programming is that
even though I am quite a klutz,
I can still produce something, in a sense
perfect, because the computer gives me as many
chances as I please to get it right.
 
L

Lew

If the computer is not in a WORKGROUP, the value can be NULL. it is
ok.

In Java that's spelled "null".
The question is not what happens if something will occur, but how to
get the name of WORKGROUP using java [sic] for different operation systems.

Of course the question is what happens when something occurs. That's what programming is - the creation of instructions to the computer to tell it what happens (well, what to make happen) when something occurs.

You should go back over the answers people have given you and assimilate them.

That said, there is possibly a way to obtain a system descriptor from the OS that tells the program whatever the OS happens to know about its network,but as everyone keeps telling you, what you want is highly system specific(as in, unique to a system). You would have to make a cross-platform system call, determine from the answer that you do or do not have Windows, thencrack down to the level of Windows-specific information.

Unfortunately for you, I do not know what such a system call would be, nor do I care to Google it for you if you aren't doing so.

GIYF.
\0\0
I recommend that you consider carefully not, "How do I determine what WORKGROUP [sic] this node is in?" but, "What am I really trying to accomplish?" Sometimes we get tunnel vision on a particular idiom when a different approach actually would suit better.

So what does having the workgroup buy you, and couldn't just knowing the IPaddress (which tells you what sub-LAN you're in) give you what you need (and in a cross-platform way!)?
 
R

Rajiv Gupta

Is there a way to get the name of WORKGROUP in java?

Hello there good Sir! I don't know why the people in this webstation
Google group page are showing strange attitude towards you. Perhaps
they think their situation and knowledge is superior and they want to
make sure that you know it.

Well, don't worry. Contrary to what these clowns are saying, there is
a portable way to do it. Java's java.util.prefs.Preferences package
provides full support for reading values from the Windows registry.

You will have to consult the Microsoft documentation to get the
registry key path to play with.
 
L

Lew

Rajiv said:
Hello there good Sir! I don't know why the people in this webstation
Google group page are showing strange attitude towards you. Perhaps

I beg your pardon, but comp.lang.java.programmer is not a Google group. It is a Usenet forum.
 
P

Paul Cager

Java's java.util.prefs.Preferences package
provides full support for reading values from the Windows registry.

You will have to consult the Microsoft documentation to get the
registry key path to play with.

If there is an environment variable set to the workgroup name you
might find it easier to read that. See

http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#getenv()

I don't have access to a Windows machine with a workgroup to check if
there is such an environment variable, but my bet is that there will
be.

As other people have pointed out this is very much system-dependent -
but that might not be a problem for you.
 
R

Roedy Green

Java is WORA. Workgroup is specific to Windows so you won't find
anything in the official Java to find it out. You would have to use
JNI or exec something to find it out.

See if there is anything in the C++ windows API to change the
workgroup. It might be considered something too dangerous to trust to
non-OS code.


Scan the Google to see if anyone has a solution, then encapsulate it
with an exec or JNI.
see http://mindprod.com/jgloss/jni.html
http://mindprod.com/jgloss/exec.html


If you were willing to endure great expense and pain, you would get
some sort of disassembler or trace debugger and watch
C:\Windows\System32\control.exe
to see what it does when you manually change the workgroup.
I used to do this all the time with 16-bit code. Then the guy who
wrote my disassembler died and the tracer Periscope went out of
business.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top