Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

java ifconfig

Thread view: 
voger - 08 Nov 2005 23:06 GMT
    Is it possible to configure network interfaces in linux using java?
Something like ifconfig or more simple, but writen in java, and without
using any native commands. I don't need to run my code in any other
operating system, just linux, but i need pure java. Can someone point me
in the right direction please?
Benji - 08 Nov 2005 23:22 GMT
>     Is it possible to configure network interfaces in linux using java?
> Something like ifconfig or more simple, but writen in java, and without
> using any native commands. I don't need to run my code in any other
> operating system, just linux, but i need pure java. Can someone point me
> in the right direction please?

Why do you need pure java, if you're doing an OS-specific operation?  Why
can't you just write a shell script that does what you want and invoke it
from java?

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Thomas Hawtin - 09 Nov 2005 00:50 GMT
>     Is it possible to configure network interfaces in linux using java?
> Something like ifconfig or more simple, but writen in java, and without
> using any native commands. I don't need to run my code in any other
> operating system, just linux, but i need pure java. Can someone point me
> in the right direction please?

Native Linux programs tend to use ifconfig. It's not particularly
reliable way to go about it, but you might as well follow them.

Actually they often use ifup and ifdown. On my machines at least, they
are script files which may do odd things and are version dependent.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Dennis Willson - 09 Nov 2005 01:28 GMT
Actually ifup and ifdown are used the most. You emulate what they do and they call a bunch of other programs (many written in C) and
scripts to do their job. I see no way to do what they do in "pure" Java. Java does doesn't have the OS API specific interface.

If you're going to be bound to a single OS anyway... just call ifup and ifdown from Java.

>     Is it possible to configure network interfaces in linux using java?
> Something like ifconfig or more simple, but writen in java, and without
> using any native commands. I don't need to run my code in any other
> operating system, just linux, but i need pure java. Can someone point me
> in the right direction please?
voger - 09 Nov 2005 18:32 GMT
Well, i need pure java because this what my project requires. Just the
kernel, the VM, maybe a boot loader and everything else java. I don't
have to use the command all the time to configure and reconfigure the
network interface. I just need my eth0 configured somehow once the
system is up and running. And that without running any native code.
I don't know, maybe my question is more linux oriented than java
oriented but i thought maybe it is something simple to be done with java.

So another approach... does anyone know any good reference on how linux
configures souch things?
Benji - 09 Nov 2005 18:47 GMT
> Well, i need pure java because this what my project requires. Just the
> kernel, the VM, maybe a boot loader and everything else java. I don't
[quoted text clipped - 3 lines]
> I don't know, maybe my question is more linux oriented than java
> oriented but i thought maybe it is something simple to be done with java.

> So another approach... does anyone know any good reference on how linux
> configures souch things?

Yes, this is not a java question - this is a linux question.  I would
advise you that you'll need more stuff than you might think.  Look at
"small" distros, like tinylinux.

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Oliver Wong - 09 Nov 2005 23:16 GMT
>> Well, i need pure java because this what my project requires. Just the
>> kernel, the VM, maybe a boot loader and everything else java. I don't
[quoted text clipped - 10 lines]
> advise you that you'll need more stuff than you might think.  Look at
> "small" distros, like tinylinux.

   If the OP is asking "What API call do I need to make to do this?" then
I'd say it's a Java question.

   And the answer I'm giving to the above question is "I wouldn't be
surprised if such a call does not exist." I may be wrong, but configuring
the ethernet adapters on the host machine may be too platform specific for
Sun to have implemented a library for this purpose.

   The OP may wish to re-analyse his/her requirements. If it's 100% known
before time that this application will only ever run on Linux, then why not
use something specific to Linux?

   - Oliver
Dennis Willson - 09 Nov 2005 23:27 GMT
>>>Well, i need pure java because this what my project requires.

This is a little vague. Since I don't think you can actually do it in "PURE" Java then you're project may not be possible. Why does
the project require it if it's OK to be platform specific? The primary reason for doing "PURE" Java is portability.

Is this by chance a school project?

Just the
>>>kernel, the VM, maybe a boot loader and everything else java. I don't
>>>have to use the command all the time to configure and reconfigure the
[quoted text clipped - 23 lines]
>
>     - Oliver
Benji - 09 Nov 2005 23:42 GMT
> This is a little vague. Since I don't think you can actually do it in "PURE" Java then you're project may not be possible. Why does
> the project require it if it's OK to be platform specific? The primary reason for doing "PURE" Java is portability.
> Is this by chance a school project?

he already answered all of these questions.  read the whole thread.  =)

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Dennis Willson - 10 Nov 2005 00:13 GMT
>>This is a little vague. Since I don't think you can actually do it in "PURE" Java then you're project may not be possible. Why does
>>the project require it if it's OK to be platform specific? The primary reason for doing "PURE" Java is portability.
>>Is this by chance a school project?
>
> he already answered all of these questions.  read the whole thread.  =)

No, he didn't answer all those questions and I DID read the WHOLE thread, did you? All he said was:

"Well, i need pure java because this what my project requires. Just the kernel, the VM, maybe a boot loader and everything else java."

How does this answer WHY it's ok to be platform specific but has to be PURE Java? When there is such a specific requirement there's
usually a reason (sometimes good and sometimes bad). Since Java was meant to be non-platform specific, there is no provision to talk
directly to OS APIs. This would rule out "PURE" Java. Was this a school assignment? A job assignment? Or just something he wants to
try and do? If the answer is just "I want to do it that way" or "I can't say" are all perfectly fine answers. The statement "i need
pure java because this what my project requires" does NOT answer WHY.

Dennis
Benji - 10 Nov 2005 00:20 GMT
> "Well, i need pure java because this what my project requires. Just the kernel, the VM, maybe a boot loader and everything else java."

> How does this answer WHY it's ok to be platform specific but has to be PURE Java? When there is such a specific requirement there's
> usually a reason (sometimes good and sometimes bad). Since Java was meant to be non-platform specific, there is no provision to talk
> directly to OS APIs. This would rule out "PURE" Java. Was this a school assignment? A job assignment? Or just something he wants to
> try and do? If the answer is just "I want to do it that way" or "I can't say" are all perfectly fine answers. The statement "i need
> pure java because this what my project requires" does NOT answer WHY.

It's platform specific if he's making a distribution that's just enough to
run a kernel and a VM.

The fact that he wants pure java tells me that it's not a school assignment,
as only a boss would know little enough about what he was saying to require
pure java.

we don't really know why in order to tell him that it's a linux question,
since there are no java APIs to deal with stuff like that.

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

David N. Welton - 10 Nov 2005 08:07 GMT
> we don't really know why in order to tell him that it's a linux question,
> since there are no java APIs to deal with stuff like that.

I have some code available here

http://www.dedasys.com/freesoftware/

that could probably be adapted via JNI to do ifconfig duties for Java.
Look for 'Tcl ifconfig' on the web page.  There's also a version
available for Python.

Signature

David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/

Andrew Thompson - 10 Nov 2005 00:28 GMT
...
> "Well, i need pure java because this what my project requires. Just the
> kernel, the VM, maybe a boot loader and everything else java."
>
> How does this answer WHY it's ok to be platform specific but has to be
> PURE Java? When there is such a specific requirement there's usually a
> reason (sometimes good and sometimes bad).

I agree.  I feel that the best answer to this question can
only be arrived at after a closer examination of the *reasons*
for the very specific requirements and constraints.

[ Just my 2c worth. ]
voger - 10 Nov 2005 18:01 GMT
> ...
>
[quoted text clipped - 10 lines]
>
> [ Just my 2c worth. ]

It is a research project. We want to see if it can be done to create
something os like by using pure java. something like jinux
(https://jinux.dev.java.net/). Unfortunately that project seems
abandoned and as i can see from the replies this is not something that
can be done easy.
Benji - 10 Nov 2005 18:51 GMT
> It is a research project. We want to see if it can be done to create
> something os like by using pure java.

Yeah...that seems like a contradiction in terms.  =)

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Oliver Wong - 10 Nov 2005 19:31 GMT
> It is a research project. We want to see if it can be done to create
> something os like by using pure java. something like jinux
> (https://jinux.dev.java.net/). Unfortunately that project seems abandoned
> and as i can see from the replies this is not something that can be done
> easy.

   You might want to be very careful how you define "pure Java"

See this thread, and the discussion between Roedy and I, for example:
http://groups.google.ca/group/comp.lang.java.advocacy/browse_thread/thread/83cce
5c1957af0b8/632d4fa48f3e302c?lnk=st


   Notice that the jinux project avoids a lot of the difficulties by not
requiring "pure Java", but instead, "100% Java OS above Minimal Linux
Kernel"

   - Oliver
Roedy Green - 10 Nov 2005 22:10 GMT
>It is a research project. We want to see if it can be done to create
>something os like by using pure java. something like jinux
>(https://jinux.dev.java.net/). Unfortunately that project seems
>abandoned and as i can see from the replies this is not something that
>can be done easy.

There is no way to write platform specific code in pure Java.  

That is like asking how do a murder someone without breaking the law.
You can do it your self,  but that is breaking the law, or you can
hire someone else to do it for you, but that too is still breaking the
law.

All you are doing metaphorically speaking is looking for a hit man who
will murder on your behalf, but not explicitly tell you that is what
he did.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Benji - 09 Nov 2005 23:41 GMT
>     If the OP is asking "What API call do I need to make to do this?" then
> I'd say it's a Java question.

well, we've already established that there is no API call to do that.

>     And the answer I'm giving to the above question is "I wouldn't be
> surprised if such a call does not exist." I may be wrong, but configuring
> the ethernet adapters on the host machine may be too platform specific for
> Sun to have implemented a library for this purpose.

this was answered by other posters.

>     The OP may wish to re-analyse his/her requirements. If it's 100% known
> before time that this application will only ever run on Linux, then why not
> use something specific to Linux?

hence why I said that it is a linux-specific question.  (He said that he
wants a distro of linux that *just* runs java, and he wanted java to
do what all of the ifup/down scripts would normally do - which is pretty
much impossible or not useful)

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Oliver Wong - 10 Nov 2005 15:40 GMT
>>     If the OP is asking "What API call do I need to make to do this?"
>> then
>> I'd say it's a Java question.
>
> well, we've already established that there is no API call to do that.

   Regardless of whether the answer is "Yes there is" or "No there isn't",
the question itself is still a Java question in my opinion.

>>     And the answer I'm giving to the above question is "I wouldn't be
>> surprised if such a call does not exist." I may be wrong, but configuring
[quoted text clipped - 3 lines]
>
> this was answered by other posters.

   Usenet is not a reliable medium. The post that I wrote and that you're
quoting is dated "2005-11-09 18:16" on my news server, and there are only 3
posts in this thread dated earlier than that; two by voger, and one by you.
So from my perspective, it was not "already established that there is no API
call to do that", and (again, from my perspective), this was NOT answered by
other posters.

   Rather than assuming that every question I've seen on usenet may have
been answered already (but just not visible to me) and refraining from
answering ANY questions, I take the opposite approach of answering every
question which I feel qualified to. And if the OP gets two answers to
his/her question, so much the better.

   I apologize if my posting philosophy/policy is not compatible with
yours.

   - Oliver
Roedy Green - 10 Nov 2005 01:00 GMT
>I just need my eth0 configured somehow once the
>system is up and running. And that without running any native code.

This is a contradiction in terms.  Anything platform specific requires
native code. Either you write it or Sun does.  Sun has not, so you
will have to.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.