LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-17-2010, 01:31 AM   #1
pcube
LQ Newbie
 
Registered: Sep 2009
Posts: 9

Rep: Reputation: 0
network configuration


hi all,
I want to do network configuration from java and i dont like to use 'exec'. Is there some API's or calls in java for that?
 
Old 03-17-2010, 01:38 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Sure. Just:
Code:
import javax.networkconfigapiforguyswhodontlikeexec.*;
 
Old 03-17-2010, 01:58 AM   #3
pcube
LQ Newbie
 
Registered: Sep 2009
Posts: 9

Original Poster
Rep: Reputation: 0
???
 
Old 03-17-2010, 01:19 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

"Network configuration" covers an awful lot of territory

Factor in the possible #/platforms (different flavors/versions of Linux; possibly Windows/different versions of Windows; who knows: maybe MacOS other other Linux) ... and the search space grows even larger.

And, as I'm sure you know, most "network configuration" involves a) editing configuration files, and b) running binary executables. There is seldom a "programming API" of any kind available, much less a programming API for Java.

So yes, whatever it is you want to do, you can probably do it from a Java program. But, depending on the specific task(s) you had in mind, it's probably going to involve "System.Runtime.exec()". Just like C/C++ would probably involve "system()" or "popen()".

IMHO .. PSM
 
Old 03-18-2010, 01:04 AM   #5
pcube
LQ Newbie
 
Registered: Sep 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Hi, thanks for the reply. I am using exec in java on an embedded linux platform to configure system. But it is causing some troubles if heavily used. I just wanted to know if any other alternative is available
 
Old 03-18-2010, 04:49 PM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Sorry, but there is no general purpose "system administration" package in Java. Depending on specifically what you want to do, you might find *some* packages ... but, for the most part, your choices are a) use exec(), b) use JNI, or c) do it completely outside of Java.

'Hope that helps .. PSM

PS:
All things being equal, my vote would be a):
1. Do the "work" in some kind of script: bash, Python, Perl: all equally effective
2. Invoke the script from Java (via exec())

PPS:
Please feel free to open a new thread on whatever problem you're experiencing with Java.System.Runtime.exec (). It's quite possibly there's an easy fix.

I suspect if you moved most of the "work" (and complexity) from Java into the script, the problem might just "disappear".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ifconfig configuration changes are not reflected in the network configuration GUI nkd Linux - Networking 4 12-25-2008 02:17 PM
Network Configuration a1ora0 Slackware 7 09-02-2007 08:42 PM
Slackware 10 network configuration. Problem with 8139 network card drivers ! Padmakiran Linux - Networking 8 03-27-2007 07:48 AM
Network Configuration in Debian (laptop network card) legendaryhwk Linux - Networking 6 04-06-2006 04:59 AM
Network Configuration Hanging in FC4 After Using Wireless Network Wizard Trip in VA Linux - Wireless Networking 2 07-18-2005 09:32 AM


All times are GMT -5. The time now is 02:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration