Solved

Problems with java 1.5 code in a java 1.4 enviroment

Posted on 2009-04-07
56
294 Views
Last Modified: 2013-12-15
Dear Experts

I just discovered that my code doesn't in the UNIX Server because it has only support 1.4 versions

About the code:
The java code collects files from the Server that starts with gencube_ and ends with .log and puts them into a file called OUT.log.
The java code has to be sound in the error department meaning it should send an error if the path or the file type doesn't exit

And the most important part is the for loop that saves EVERY corresponding file to the Out.log

This is the code:



public class LogFileCopyPaste {
public static boolean fileExist = false;

public static void main(String[] args) throws SQLException, IOException {



File path = new File("app/home/ninja/java_test");
FileWriter fileWriter  = new FileWriter("app/home/ninja/java_test/OUT.log");
PrintWriter outputStream  = new PrintWriter(fileWriter);

if (!path.isDirectory()){
outputStream.println("Error 0001: The path doesn't exist");
fileExist = true;
}
else{
for (File mainFile :
path.listFiles(new FileFilter(){
public boolean accept(File f) {

String name = f.getName().toLowerCase();

//file name filtering
if(name.endsWith(".log")&&name.startsWith("gencube_",0)){
      fileExist = true;
      return true;
}
else{
      return false;
}


}
})//ends the path.listfiles
)//ends the for(File)
{

String dirLoc = mainFile.toString();
String []dirLoc2 = dirLoc.split("/n");
for(int v= 0; v<dirLoc2.length;v++){
System.out.println(dirLoc2[v]);      
outputStream.println(dirLoc2[v]);

}      

}
outputStream.close();
}
if (fileExist==false) {
outputStream.println("Error 0002: There are no Gencube");
}            
}
}
0
Comment
Question by:matrixrasta
  • 28
  • 21
  • 4
  • +1
56 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 24084528
all you have to update the for loop to be compatible with 1.4!
0
 
LVL 92

Expert Comment

by:objects
ID: 24084530
looks like you just need to compile it for 1.4
javac -target 1.4 -source 1.4 ....
0
 

Author Comment

by:matrixrasta
ID: 24084644
How is this done?
updating the for loop that is?
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24084656
>>for (File mainFile :
path.listFiles(new FileFilter(){
public boolean accept(File f) {

String name = f.getName().toLowerCase();

//file name filtering
if(name.endsWith(".log")&&name.startsWith("gencube_",0)){
      fileExist = true;
      return true;
}
else{
      return false;
}


}
})//ends the path.listfiles
)//ends the for(File)
>>

replace that with below,

File[] files = for (File mainFile :
path.listFiles(new FileFilter(){
public boolean accept(File f) {

String name = f.getName().toLowerCase();

//file name filtering
if(name.endsWith(".log")&&name.startsWith("gencube_",0)){
      fileExist = true;
      return true;
}
else{
      return false;
}


}
})//ends the path.listfiles
) ; //ends the for(File)

for( int i = 0; i < file.length; i++ ){
//String dirLoc = mainFile.toString();
String dirLoc = file[i].toString();
...
...
...
}
0
 

Author Comment

by:matrixrasta
ID: 24084699
There was a syntax error at the
>>File[] files = for (File mainFile :

Syntax error on token "=", ; expected
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24104261
can you post your modified code?
0
 

Author Comment

by:matrixrasta
ID: 24105202
Now this is the modified code

public static boolean fileExist = false;
       
public static void main(String[] args) throws SQLException, IOException {
           
File path = new File("app/home/ninjat389461/java_test");
FileWriter fileWriter  = new FileWriter("app/home/t389461/java_test/OUT.log");
PrintWriter outputStream  = new PrintWriter(fileWriter);

if (!path.isDirectory()){
outputStream.println("Error 0001: The path doesn't exist");
fileExist = true;
}
else{
File[] files = for (File mainFile :
    path.listFiles(new FileFilter(){
    public boolean accept(File f) {

    String name = f.getName().toLowerCase();

    //file name filtering
    if(name.endsWith(".log")&&name.startsWith("gencube_",0)){
          fileExist = true;
          return true;
    }
    else{
          return false;
    }


    }
    })//ends the path.listfiles
    ) ; //ends the for(File)

{
                   
String dirLoc = mainFile.toString();
String []dirLoc2 = dirLoc.split("/n");
for(int v= 0; v<dirLoc2.length;v++){
    System.out.println(dirLoc2[v]);    
    outputStream.println(dirLoc2[v]);

}    
               
}
outputStream.close();
}
if (fileExist==false) {
outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
}        
}
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24105276
try this,

if (!path.isDirectory()){
outputStream.println("Error 0001: The path doesn't exist");
fileExist = true;
}
else{
File[] files = path.listFiles(new FileFilter(){
public boolean accept(File f) {

String name = f.getName().toLowerCase();

//file name filtering
if(name.endsWith(".log")&&name.startsWith("gencube_",0)){
      fileExist = true;
      return true;
}
else{
      return false;
}


}
})//ends the path.listfiles
) ; //ends the for(File)

for( int i = 0; i < files.length; i++ ){
String dirLoc = files[i].toString();
String []dirLoc2 = dirLoc.split("/n");
for(int v= 0; v<dirLoc2.length;v++){
    System.out.println(dirLoc2[v]);    
    outputStream.println(dirLoc2[v]);

}    
               
}
outputStream.close();
}
if (fileExist==false) {
outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
}        
}
0
 
LVL 35

Expert Comment

by:TimYates
ID: 24105280
Like this (maybe)
  public static void main(String[] args) throws SQLException, IOException {

    File path = new File("app/home/ninjat389461/java_test");

    PrintWriter outputStream = new PrintWriter( new FileWriter( "app/home/t389461/java_test/OUT.log" ) ) ;
 

    if( !path.isDirectory() ) {

      outputStream.println("Error 0001: The path doesn't exist");

      fileExist = true;

    }

    else {

      File[] files = path.listFiles( new FileFilter() {

        public boolean accept(File f) {

          String name = f.getName().toLowerCase();

          //file name filtering

          if (name.endsWith(".log") && name.startsWith("gencube_", 0)) {

            fileExist = true;

            return true;

          } else {

            return false;

          }

        }

      } ) ; 

      for( int i = 0 ; i < files.length ; i++ )        

      {

        String dirLoc = files[ i ].toString();

        String[] dirLoc2 = dirLoc.split("/n");

        for (int v = 0; v < dirLoc2.length; v++) {

          System.out.println(dirLoc2[v]);

          outputStream.println(dirLoc2[v]);

        }
 

      }

      outputStream.close();

    }

    if (fileExist == false) {

      outputStream.println("Error 0002: There are no Gencube Log Files in the directory");

    }

  }

Open in new window

0
 
LVL 35

Expert Comment

by:TimYates
ID: 24105285
(PS:  I am just building on the work of others...this shouldn't be considered an answer on its own)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 24105293
Lol...  Also, I was soundly beaten to the punch ;-)

Doh!  Too slow!
0
 

Author Comment

by:matrixrasta
ID: 24105469
thanks but there is a new error message:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Test (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 24105476
Are you using the -target and -source parameters for javac like objects told you to in the second comment on this question?
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24105481
looks like a class compiled in higher version is used! btw, what version of JDK you are using?
0
 

Author Comment

by:matrixrasta
ID: 24105507
sorry about that i forgot to configure the compiler in eclipse, i've just done that and now here is the next error:
Exception in thread "main" java.lang.NoSuchMethodError: java.io.PrintWriter.<init>(Ljava/lang/String;)V
        at Test.main(Test.java:18)
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24105524
are you using any of the below ctors from PrintWriter,

PrintWriter(String fileName)
PrintWriter(File file)

these are available only from jdk1.5
0
 

Author Comment

by:matrixrasta
ID: 24105539
Yep im using the
>>PrintWriter outputStream = new PrintWriter( new FileWriter(
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24105555
No, looks like, you use PrintWriter(String fileName)! change that to pass FileWriter as you posted in the last comment!
0
 

Author Comment

by:matrixrasta
ID: 24105628
This is the present code:

public static void main(String[] args) throws SQLException, IOException {
    File path = new File("app/home/ninjat389461/java_test");
    PrintWriter outputStream = new PrintWriter( new FileWriter( "app/home/t389461/java_test/OUT.log" ) ) ;
 
    if( !path.isDirectory() ) {
      outputStream.println("Error 0001: The path doesn't exist");
      fileExist = true;
    }
    else {
      File[] files = path.listFiles( new FileFilter() {
        public boolean accept(File f) {
          String name = f.getName().toLowerCase();
          //file name filtering
          if (name.endsWith(".log") && name.startsWith("gencube_", 0)) {
            fileExist = true;
            return true;
          } else {
            return false;
          }
        }
      } ) ;
      for( int i = 0 ; i < files.length ; i++ )        
      {
        String dirLoc = files[ i ].toString();
        String[] dirLoc2 = dirLoc.split("/n");
        for (int v = 0; v < dirLoc2.length; v++) {
          System.out.println(dirLoc2[v]);
          outputStream.println(dirLoc2[v]);
        }
 
      }
      outputStream.close();
    }
    if (fileExist == false) {
      outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
    }
  }

and this one didn't work:

public static boolean fileExist = false;
       
public static void main(String[] args) throws SQLException, IOException {
           
File path = new File("app/home/ninjat389461/java_test");
FileWriter fileWriter  = new FileWriter("app/home/t389461/java_test/OUT.log");
PrintWriter outputStream  = new PrintWriter(fileWriter);

if (!path.isDirectory()){
outputStream.println("Error 0001: The path doesn't exist");
fileExist = true;
}
else{
File[] files = for (File mainFile :
    path.listFiles(new FileFilter(){
    public boolean accept(File f) {

    String name = f.getName().toLowerCase();

    //file name filtering
    if(name.endsWith(".log")&&name.startsWith("gencube_",0)){
          fileExist = true;
          return true;
    }
    else{
          return false;
    }


    }
    })//ends the path.listfiles
    ) ; //ends the for(File)

{
                   
String dirLoc = mainFile.toString();
String []dirLoc2 = dirLoc.split("/n");
for(int v= 0; v<dirLoc2.length;v++){
    System.out.println(dirLoc2[v]);    
    outputStream.println(dirLoc2[v]);

}    
               
}
outputStream.close();
}
if (fileExist==false) {
outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
}        
}


0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24105666
can u post the stack now?
0
 

Author Comment

by:matrixrasta
ID: 24105955
That's the stack above! Or what do you mean by stack to be precise
This is what you suggested I should do


public static boolean fileExist = false;
       
public static void main(String[] args) throws SQLException, IOException {
           
File path = new File("app/home/ninjat389461/java_test");
FileWriter fileWriter  = new FileWriter("app/home/t389461/java_test/OUT.log");
PrintWriter outputStream  = new PrintWriter(fileWriter);
if (!path.isDirectory()){
outputStream.println("Error 0001: The path doesn't exist");
fileExist = true;}
else{
File[] files = for (File mainFile :
    path.listFiles(new FileFilter(){
    public boolean accept(File f) {
    String name = f.getName().toLowerCase();
    //file name filtering
    if(name.endsWith(".log")&&name.startsWith("gencube_",0)){
          fileExist = true;
          return true;
    }
    else{
          return false;
    }
    }
    })//ends the path.listfiles
    ) ; //ends the for(File)
{                    
String dirLoc = mainFile.toString();
String []dirLoc2 = dirLoc.split("/n");
for(int v= 0; v<dirLoc2.length;v++){
    System.out.println(dirLoc2[v]);    
   outputStream.println(dirLoc2[v]);
}                    
}
outputStream.close();
}
if (fileExist==false) {
outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
}        
}


And this is the error message which was created

Syntax error on token "=", ; expected towards the >>File[] files = for (File mainFile :
0
 
LVL 26

Accepted Solution

by:
ksivananth earned 500 total points
ID: 24105982
you repeat the earlier cleared problem!

when you have the below code, what is the erro message you get, may the emssage is same but diff line number,

statck - exception stack trace!

public static void main(String[] args) throws SQLException, IOException {
    File path = new File("app/home/ninjat389461/java_test");
    PrintWriter outputStream = new PrintWriter( new FileWriter( "app/home/t389461/java_test/OUT.log" ) ) ;
 
    if( !path.isDirectory() ) {
      outputStream.println("Error 0001: The path doesn't exist");
      fileExist = true;
    }
    else {
      File[] files = path.listFiles( new FileFilter() {
        public boolean accept(File f) {
          String name = f.getName().toLowerCase();
          //file name filtering
          if (name.endsWith(".log") && name.startsWith("gencube_", 0)) {
            fileExist = true;
            return true;
          } else {
            return false;
          }
        }
      } ) ;
      for( int i = 0 ; i < files.length ; i++ )        
      {
        String dirLoc = files[ i ].toString();
        String[] dirLoc2 = dirLoc.split("/n");
        for (int v = 0; v < dirLoc2.length; v++) {
          System.out.println(dirLoc2[v]);
          outputStream.println(dirLoc2[v]);
        }
 
      }
      outputStream.close();
    }
    if (fileExist == false) {
      outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
    }
  }


0
 

Author Comment

by:matrixrasta
ID: 24106098
Thanks
I entered your above code and is showed this error
Exception in thread "main" java.io.FileNotFoundException: app/home/t389461/java_test/OUT.log (No such file or directory)

And I noticed that I'm in the folder app/home/t389461/java_test/ so I removed changed the code to
PrintWriter outputStream = new PrintWriter( new FileWriter( "OUT.log" ) ) ;
and now it creates the OUT.log file but doesn't fill it with the gencube*.log names

0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106118
>>File path = new File("app/home/ninjat389461/java_test");

modify the path appropriately!
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106138
//try this, if your in the same folder
File path = new File("");
0
 

Author Comment

by:matrixrasta
ID: 24106153
sorry about that (Type error) but thats was the path i used.
I would just like a basic code that can collect all the gencube files and System.out.println(the gencubenames)
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106170
can you print and post the result?
System.out.println( "Directory Name: " + new File( "" ).getAbsolutePath() ) ;
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:matrixrasta
ID: 24106245
Directory Name: /app/home/ninjat389461/java_test
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106257
>>System.out.println(dirLoc2[v]);

what that prints?
0
 

Author Comment

by:matrixrasta
ID: 24106271
When I type: ls
Result:
test.txt
gencube_2IN.log                                          Two.jar
gencube_IN.log                                           UnixRunner.jar
GenList.txt                                              unixrunner.ksh
IN.txt                                                   UnixTest.ksh
OUT.log                                                  UnixTest.log
OUT.txt                                                  UnixTest002.jar
0
 

Author Comment

by:matrixrasta
ID: 24106280
>>System.out.println(dirLoc2[v]);
It does nothing hence it doesn't enter the loop
0
 

Author Comment

by:matrixrasta
ID: 24106289
And When I type :
$ pwd
/app/home/ninjat389461/java_test
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106293
String dirLoc = files[ i ].toString();
System.out.println(dirLoc);
        String[] dirLoc2 = dirLoc.split("/n");

can you post what it prints? also dirLoc.split("/n"); wht are you trying to do with this?
0
 

Author Comment

by:matrixrasta
ID: 24106377
It does noting! Like i said it doesn't get to the loop and as for the dirLoc.split was the code that was written for me what it actually does i really don't know. I'll try to use the System.out to trace where the loop stops
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106392
can you print the name of the file after the line
name
//file name filtering
System.out.println("Listed File NAME: " + name );
0
 

Author Comment

by:matrixrasta
ID: 24106410
Okay the dirLoc.split("/n"); separates all the filenames and is kept in an array i guess
0
 

Author Comment

by:matrixrasta
ID: 24106442
nothing in the unix server but in the windows Listed File NAME: gencube_2in.log

P.S. In the windows i change the path name and it does work in windows
0
 

Author Comment

by:matrixrasta
ID: 24106612
I've cross checked the Unix path and every thing is up to scratch

$ cd /
$ cd app/home/ninjat389461/java_test
$ pwd
/ app/home/ninjat389461/java_test
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106626
>>nothing in the unix server but in the windows Listed File NAME: gencube_2in.log

why its not prinitng all file names? can u post the current code?
0
 

Author Comment

by:matrixrasta
ID: 24106664
     public static boolean fileExist = false;

      
      public static void main(String[] args) throws IOException {
          File path = new File("app/home/ninjat389461/java_test");
            
          PrintWriter outputStream = new PrintWriter( new FileWriter( "OUT.log" ) ) ;
          
          if( !path.isDirectory() ) {
            outputStream.println("Error 0001: The path doesn't exist");
            fileExist = true;
          }
          else {
            File[] files = path.listFiles( new FileFilter() {
              public boolean accept(File f) {
                String name = f.getName().toLowerCase();
                System.out.println("Listed File NAME: " + name );
                //file name filtering
                if (name.endsWith(".log") && name.startsWith("gencube_", 0)) {
                  fileExist = true;
                  return true;
                } else {
                  return false;
                }
              }
            } ) ;
            for( int i = 0 ; i < files.length ; i++ )        
            {
                
              String dirLoc = files[ i ].toString();
              String[] dirLoc2 = dirLoc.split("/n");
              for (int v = 0; v < dirLoc2.length; v++) {
                System.out.println(dirLoc2[v]);
                outputStream.println(dirLoc2[v]);
              }
              
            }
            outputStream.close();
            
          }
          if (fileExist == false) {
            outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
          }
          //System.out.println( "Directory Name: " + new File("").getAbsolutePath() ) ;
        }
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106680
>>System.out.println("Listed File NAME: " + name );

this should print all the files under that directory but you are saying it prints just one file in windows and nothing in unix, strange!
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24106682
are you sure if the files are not hidden?
0
 

Author Comment

by:matrixrasta
ID: 24106728
i dont this so:
$ ls -l gencube_*.log
-rw-r-----   1 ninjat389461  GEN01      11445 Apr  9 13:25 gencube_2IN.log
-rw-r-----   1 ninjat389461  GEN01      11445 Apr  9 13:25 gencube_IN.log
0
 

Author Comment

by:matrixrasta
ID: 24106772
false
Its in the Else loop
Exception in thread "main" java.lang.NullPointerException
        at Two.Two.main(Two.java:39)

That is the for( int i = 0 ; i < files.length ; i++ ){

package Two;
import java.io.*;

/**
 *
 */

/**
 * @author t389461
 *
 */
public class Two {
      public static boolean fileExist = false;
      
      public static void main(String[] args) throws IOException {
          File path = new File("app/home/ninjat389461/java_test");
            
          PrintWriter outputStream = new PrintWriter( new FileWriter( "OUT.log" ) ) ;
          System.out.println(path.isDirectory());
          /*if( !path.isDirectory() ) {
            outputStream.println("Error 0001: The path doesn't exist");
            fileExist = true;
          }
          else {*/
                System.out.println("Its in the Else loop");
            File[] files = path.listFiles( new FileFilter() {
              public boolean accept(File f) {
                String name = f.getName().toLowerCase();
                System.out.println("Listed File NAME: " + name );
                //file name filtering
                if (name.endsWith(".log") && name.startsWith("gencube_", 0)) {
                  fileExist = true;
                  return true;
                } else {
                  return false;
                }
              }
            } ) ;
            for( int i = 0 ; i < files.length ; i++ ){
                String dirLoc = files[ i ].toString();
              String[] dirLoc2 = dirLoc.split("/n");
              for (int v = 0; v < dirLoc2.length; v++) {
                System.out.println(dirLoc2[v]);
                outputStream.println(dirLoc2[v]);
              }
              
            }
            outputStream.close();
            
          //}
          if (fileExist == false) {
            outputStream.println("Error 0002: There are no Gencube Log Files in the directory");
          }
          //System.out.println( "Directory Name: " + new File("").getAbsolutePath() ) ;
        }


      
}
0
 

Author Comment

by:matrixrasta
ID: 24106781
Or better still if you have made a code similar to that that working unix can you post it please?
0
 

Author Comment

by:matrixrasta
ID: 24106900
In Windows the System.out.println(path.isDirectory()); is true in Windows and False in Unix
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24107127
System.out.println(path.getAbsolutePath());
System.out.println(path.exists()) ;

what it prints in Unix?
0
 

Author Comment

by:matrixrasta
ID: 24127044
like i said b4  /app/home/ninjat389461/java_test.
Do you have a working code that recieves specific files in a Unix enviroment?
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24128234
>>Do you have a working code that recieves specific files in a Unix enviroment?

yes I do but its not that different than you have!

can you post the result of below?

System.out.println(path.exists()) ;
System.out.println(path.canRead()) ;
System.out.println(path.isFile()) ;
System.out.println(path.isDirectory()) ;
System.out.println(path.isHidden()) ;
0
 

Author Comment

by:matrixrasta
ID: 24128913
I actually dont have the pc at my disposal at the moment. Ill send you the result first thing tomorrow
Thanks for your support
0
 

Author Comment

by:matrixrasta
ID: 24139252
Thanks for you help. I actually found an alternative and it works just fine for me.

Java Code:
public static void main(String[] args) throws IOException {

LogFilePlus lfp = new LogFilePlus();      
Runtime runtime = Runtime.getRuntime();

//Unix Command
Process process = runtime.exec(lfp.UnixExecute("ls /app/home/ninja/UnixParse"));

InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;

while ((line = br.readLine()) != null) {      
//line holds every file that starts and end with the followings
if(line.toLowerCase().endsWith(".log")&& line.toLowerCase().startsWith("gencube_",0)){


Runtime runtime2 = Runtime.getRuntime();
Process process2 = runtime2.exec(lfp.UnixExecute("/app/home/ninja/get_transformer_pid.sh /app/gen/dyn/gen/logs/"+line));

InputStream is2 = process2.getInputStream();
InputStreamReader isr2 = new InputStreamReader(is2);
BufferedReader br2 = new BufferedReader(isr2);
String line2;

while ((line2 = br2.readLine()) != null) {      

if(line2.equals("")){
      System.out.println("The Log-File "+line +" is closed");                                    
}
else{
      System.out.println("It is opened");
}
}                        
}
}
}


lfp.UnixExecute(String sCommand) is

public String UnixExecute(String sCommand){
 String stemp = sCommand;
 return stemp;
}


0
 

Author Closing Comment

by:matrixrasta
ID: 31567379
Thanks any way
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 24139304
this is nothing but introducing unecessay complication!

you should be able to traverse through file.list!
0
 

Author Comment

by:matrixrasta
ID: 24141597
>> this is nothing but introducing unecessay complication!
What exactly do you mean? Could you please post you suggestion(Java code that is!)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now