Problem with Temp file and Thread

A

andrewzzz

Hi sir,
I have some problems with temp file and thread...
Here is my small code:

try {
// Create temp file.
File tmp = File.createTempFile(agentclass, ".java");
// Delete temp file when program exits.
tmp.deleteOnExit();
// Write agent's byte[] code to temp file
OutputStream out = new FileOutputStream(tmp);
out.write(code);
out.close();

} catch (IOException e) {
System.out.println("Unrecoverable I/0 Error");
throw e;

}


agentclass agent=new agentclass(agentname,am);
agent.start();


Where agentclass should be he file just loaded but I don't know how to
use it..
This part of code receives byte[] code,String agentclass,String
agentname
from 3 static methods of the class sp.
I have to create a temp file with the name specified in String
agentclass , with .java extension(it's a java class).Then I have to
write the byte[] code to the just created tmp file.
The file created is a class which extends Thread class and I have to
start this Thread just after loading the byte[] into it..



Many Thanks for Your Great Help
Bye Guys and Sorry for My English
 

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,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top