André,

   Já tentei e descobri q existem pelo menos duas formas:

1) no email a seguir, a primeira:

[EMAIL PROTECTED] wrote:

> Hi Gian,
>
> I did find a solution to this problem.  I used the Runtime class to get an instance of a Process.  The Process object can run system commands ( i.e. unix commands, or scripts ) from within your JVM.  The process object has an input stream that is associated with it that you can read the output from the system command you want to execute.  In this instance you can use the Unix command tar cvf /dev/rmt/0 <file to archive> to archive a file to your tape drive.  The code would look something like this:
>
> command = "tar cvf /dev/rmt/0 " + fileToArchive;
> Runtime run = Runtime.getRuntime();
> process = run.exec( command );
>
> *NOTE*  The run.exec("some system command") method does not work well with some unix custom created scripts (i.e. ones that you create yourself).
> It will work most of the time with the built in Unix commands such as ls, rm, cp, mv, tar etc.  Here is some sample code that should point you in the right direction for the Runtime and process usage.
>
> *CODE*
> import java.lang.Runtime;
> import java.io.*;
> import java.lang.StringBuffer;
> //import java.lang.Process;
>
> public class UnixCommand
> {
>     public UnixCommand()
>     {
>     try{
>
>         InputStream in;
>         String input;
>
>             //create your process object
>         Process process;
>
>             //get the instance of your Runtime
>         Runtime run = Runtime.getRuntime();
>
>             //this command should list the files in your current directory
>             //in Unix
>         String command = "ls";
>         process = run.exec( command );
>
>         BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
>
>             //read in the files that the command prints to standard output
>         input = br.readLine();
>         while( input != null )
>         {
>             input = br.readLine();
>             if( input == null )
>             ;
>             else
>             System.out.println( input );
>         }
>
>     }catch( IOException run ){ run.printStackTrace();
>     }
>
>     }
>
>     public static void main( String args[] )
>     {
>     UnixCommand uc = new UnixCommand();
>     }
> }
>
> Hope this helps Gian, let me know if you have any more questions.
>
> Gian Peduto wrote:
> >
> > Hello,
> >
> >    I found a message in the Java Developers Connection Site and  I'm
> > developing an application that must have tape drive access, how did you
> > solutioned this problem?
> >
> > Thanks in Advance,
> >
> >    Gian
> > --
> > -------------------------------------------------------
> >   Gian Paolo Peduto


A segunda: através de JNI vc encapsula em classes java os comandos que fazem acesso à tape (provavelmente em C/C++, o código do comando 'tar' me foi indicadi). Esta é a  melhor solução, pq não precisa chamar o SO para executar nada, não abrindo brechas, porém dá um bom trabalho e vc tem saber bem o q está fazendo.

[]'s Gian



André Luís Moser wrote:
011501c15d7d$f2dcb410$bc086264@moser">
Alguem sabe como enviar um arquivo para um fita Dat
através do java ? 
Quem com certeza tem como, mais como ?
 
Qualquer dica é bem vinda, valeu !
André.

Responder a