cancel
Showing results for 
Search instead for 
Did you mean: 

.JAR File for FileLookup UDF

0 Kudos

Hi Experts ,

We have a requirement for filelookup and we have written the UDF for it. In the UDF we are using URL and InputBufferReader and therefore we require java.net.* JAR package. Please suggest a location to download the same from. If the file is available in the PI Installation or server location, Please share the path for it as well.

Thanks in advance.

Amitosh Srivastava

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Amitosh,

You don't need to download a jar to use the Java.net package as ist part of the jdk that PI uses.

If you want to use it in your UDF you only need to delcare in your Import packages "java.net.*"

Btw to use BufferedReader it would be "java.io.*" package in your imports

Best regards

           Sebastian

former_member186851
Active Contributor
0 Kudos

Import the below and check

  • java.io.InputStream
  • java.io.FileInputStream
anupam_ghosh2
Active Contributor
0 Kudos

Hi Amitosh,

                    The reason of this error might not be due to wrong import. To investigate the cause need to go through entire code. A "Cannot find symbol" error means that the compiler cannot do this. Your code appears to be referring to something that the compiler doesn't understand.

For example, maybe you "star" imported java.io.* and then tried to use the Files class ... which is in java.nio not java.io. Or maybe you meant to write File ... which is a class in java.io.


Please paste your code as a function in eclipse or NWDS. remove all import statements. Now it will prompt you suggestions to correct the errors if you right click on location of those errors. Once you select the correct options exact import statements will show up. Then you can add those classes in the UDF. I guess by this way you can get rid of these errors.

Regards

Anupam

0 Kudos

@Raghuraman Sritharan :

Still the same error

Answers (2)

Answers (2)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Amitosh,

                      Please check this link File Lookup in UDF - Process Integration - SCN Wiki

You do not need to use "InputBufferReader" in your UDF. This can be achieved using standard classes.

You can face issue with URL class. which can be resolved using this line in the code


try {

  java.net.URL url=new java.net.URL("xyz.com");

  } catch (MalformedURLException e) {

  e.printStackTrace();

  }

Regards

Anupam

0 Kudos

Hi Anupam,

Can you kindly suggest the standard class name which we can use.

Thanks

Amitosh Srivastava

anupam_ghosh2
Active Contributor
0 Kudos

Hi Amitosh,

              You have not provided the code you are using here, still I am sure you can replace "InputBufferReader" with "InputStreamReader" i.e java.io.InputStreamReader.

Thus you need to e use below import statements


import java.io.InputStreamReader;

import java.net.URL;


In case you have issues compiling, please post the code.

Will look into it.


Regards

Anupam

former_member186851
Active Contributor
0 Kudos

Hello Amitosh,

In UDF I dont think you need deploy any Jar.

Try maintaing the below Import in the UDF.

  • java.lang.Object
  • java.io.Reader
  • java.io.StringReader