Java - POSIX

P

Paddy

I am stuck with a problem in the migration of C++ code that does a lot
of System Programming to be converted to Java.I dont know how exactly
should I translate the preprocessor directives like #include
<sys/utmp.h> and other system files that vary by the falvor of Unix
slightly.

I have to preserve the portability as well as tie it to system
specific record structures.Seems impossible without using JNI but then
JNI involves more headaches and frankly I am stumped as to the
implementation

Can someone throw some light on the issue of using Java for system
programming purposes on Unix?

Thanks a lot
Paddy
 
S

Shripathi Kamath

Paddy said:
I am stuck with a problem in the migration of C++ code that does a lot
of System Programming to be converted to Java.I dont know how exactly
should I translate the preprocessor directives like #include
<sys/utmp.h> and other system files that vary by the falvor of Unix
slightly.

I have to preserve the portability as well as tie it to system
specific record structures.Seems impossible without using JNI but then
JNI involves more headaches and frankly I am stumped as to the
implementation

Can someone throw some light on the issue of using Java for system
programming purposes on Unix?

Thanks a lot
Paddy


Depends on your definition of "system programming". For things that are not
supported by Java in its APIs, you will need JNI modules, but that is not a
law, just an expectation.

It is foolhardy to attempt convert a C source file to a Java source file.
You are better off trying to convert your application such that your Java
application is functionally equivalent.

Maybe if you gave more definition of your problem space?
 
S

Sudsy

Paddy wrote:

Can someone throw some light on the issue of using Java for system
programming purposes on Unix?

Thanks a lot
Paddy

Paddy,
Java just isn't the right tool for system programming, on UNIX
or any other operating system. You can hook into the existing code
quite readily with JNI. Visit the Sun site for examples.
 
P

Paddy

I have a bunch of issues here in migrating a legacy application that
uses utmp and wtmp for login and connect time information.


Structure related porting automatically comes in C because of header
file inclusion. But in our Java case, the structure in above mentioned
flat file had to be changed as per the platform so that Java code can
pick proper sized records fron input binary file and then take out
each
field. Right ?? No??

I dont know frankly how to go about picking the right design.

for example C can get system configuration with Sysconf(). Java has no
mechanism to read system configuation or platform type other than
process.getRuntime API which to an extent is useful in my porting.

Thanks for the reply though

Paddy
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top