beans and C code in java prog.

N

Nishi Bhonsle

I have to write a bean that triggers an event that removes a given file on the condition of the file system being full.
Since I am new to java beans, can you someone please let me know if I could do the follow the below approach-->

Create 3 classes --
FileSystemFullListener--interface extending EventListener
FileSystemFullBean--source bean that fires the systemFull event
FileSystemFullEvent
I will write a C program to detect the systemFull event. I should be including the systemFull call in the FileSystemFullEvent class, right?
How can I execute a C program call through a java program?


Thanks.
 
B

Brad BARCLAY

Nishi said:
I will write a C program to detect the systemFull event. I should be including the systemFull call in the FileSystemFullEvent class, right?
How can I execute a C program call through a java program?

You have two options: if the C program is indeed a stand-alone
executable application, you can use one of the java.lang.Runtime.exec()
methods.

If, instead the C code you want to call is part of a library, you're
going to have to use JNI, the Java Native Interface.

HTH!

Brad BARCLAY
 

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