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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top