How to get stylesheet object from JAVA RESOURCE stored in DB

Hi,
I stored a xslt file in the database and have a JAVA RESOURCE file now. How can i get a stylesheet object from this resource file?
I took the following class to get an impression how to get the contents of the resource but -although the name of the resource was spelled correctly- i got a file not found exception.
Whats wrong?
public class PrintRessource {
public static void print (String p_ressource){
try {
Class c = PrintRessource.class;
System.out.println(c.toString());
InputStream file = c.getResourceAsStream(p_ressource);
if (file == null)
throw new FileNotFoundException("XSLT file not in DB");
byte[] buffer = new byte[4096];
int bytes_read;
while ((bytes_read = file.read(buffer)) != -1)
System.out.println(new String(buffer, 0 , buffer.length));
catch (Exception exp) {
System.out.println(exp);
Thanks

The code works as is. I just forgot to add the slash in front of the Resource file name.

Similar Messages

  • How to get return value from Java runtime.getRuntime.exec?

    I'm running shell commands from an Oracle db (11gr2) on aix.
    But, I would like to get a return value from a shell comand... like you get with "echo $?"
    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        return retval;
    /but I do not get a return value... because I don't know how to get return value..
    Edited by: user9158455 on 22-Sep-2010 07:33

    Hi,
    Have your tried pr.exitValue() ?
    I think you also need a finally block that destroys the subprocess
    Regards
    Peter

  • How to get the parameter from Java Script into the Parameter crystal Report

    Hi All,
    Crystal Report is integrated with Oracle 10g. I created the base SQL query for col1, col2, col3 and col4. Java Script pass parameter value (185) to Col1.
    My question is how to create crystal report to make Col1 as parameter and how to get the parameter value 185(Col1) from Java Script. Is there any additional code I need to include in the crystal report?
    FYI.
    Java script sends the right parameter value.There is no issue in java script.
    This is an automatic scheduled process when batch runs, Java script should pass the parameter value and the crystal report should get the value and produce the output report.

    Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
    If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
    Please clarify?

  • How to get File  object from Document Object . ?

    In conventional Dom Parsing we pass file to DocumentBuilder to get Document Object .
      File file = new File("c:\\MyXMLFile.xml");
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(file); // gOT Document here . My problem is how do i get File object back from Document . If i have Document object with mi.
    Please consider above code as example i dont have File object in my code . i am using Xhive DB API where i get Document directly from API method .
    I need to convert this Document to File to get size of file
    Please suggest solution on this
    Edited by: AmitChalwade123456 on Dec 5, 2008 6:10 AM

    Hello Guys any views on this topic

  • How to return custJava Object from Java Stored Function/Procedure to Java Application

    I WILL PAY $100 FOR SOLUTION.
    Oracle JDBC documentation gives step by step on how to return Oracle Type Object to Java Application. No question here.
    But is it possible to create Java Stored Function [getMyClass() ] which returns CUSTOM Java based object [MyClass] to Java application like:
    //java stored function
    class Foo
    public static MyClass getMyClass()
    return new MyClass();
    //java class I want to return to Java
    class MyClass
    public String getGreetings(String name)
    return "Hello " + name;
    I tried to do it using intermittent Oracle
    Type Object and OracleConnection map to make binding between Java->Oracle->Java. I could
    not get throgh meaningless run time ORA Errors. Any kind of help would be greatly
    appreciated. If you know the answer please
    post it or e-mail [email protected]
    null

    You don't say which version of the database you are on. There's an interesting looking article on OTN on handling CLOBs in JDBC in 10g. It may well be useful for earlier versions too (but no guarantees).
    Cheers, APC

  • How to get UCM content from Java class?

    Hello,
    I need to get UCM content from backend I mean from the Java class. Is there any way to do that? If anybody please give any resources it will be very helpful.
    Thanks and regards.

    Hi
    You mean to say that with JAVA API you want to search and retrieve the contents ? If yes , then you should use RIDC API for the same and that way you can use to do all the operations on UCM from the JAVA Api .
    Search this forum and you will get sample codes for the checkin , search , checkout operations .
    Documentation is available at : http://docs.oracle.com/cd/E14571_01/doc.1111/e16819/toc.htm
    Thanks
    Srinath

  • How to get return value from java and read by other application?

    i want to read return value from java and the other application read it.
    for example:
    public class test_return {
        test_return(){
        public int check(){
            return 1;
        public static void main(String args[]){
           new test_return().check();
    }from that class i make as jar file. How to read the return value (1) by other application?
    thx..

    If your installer is requiring some process it invokes to return a particular value on failure, then the installer is seriously broken. There are a bazillion commands your installer could invoke, and any of them could fail, which in turn could invalidate the entire install process, and any of them could return any value on failure. The only value that's consistent (in my experience) is that zero means success and non-zero means failure, with specific non-zero values being different in different programs.
    About the only control you have over the JVM's exit code is that if your main method completes without throwing an exception, the JVM will have an exit code of 0, and if main throws an exception (either explicitly or by not catching one thrown from below), it will be non-zero. I'm not even sure if that's guaranteed, but I would guess that's the case.
    EDIT: I'm kind of full of crap here. If you're writing the Java code, you can call System.exit(whatever). But nonetheless, if your installer requires certain exit codes from any app--java or otherwise--you have a problem.
    Edited by: jverd on Oct 29, 2009 1:27 AM

  • How to get the object from an event

    Hey, thanks for helping.
    I'm trying to get the causing object from the event so i can run a method from the causing object,
    I tred using the getSource method inherited from the Event class but it doesn't see the method I have in that object (method1)
    I have this code:
    private class Over implements MouseListener
    public void mouseClicked(MouseEvent e)
    public void mousePressed(MouseEvent e)
    public void mouseReleased(MouseEvent e)
    public void mouseExited(MouseEvent e)
    public void mouseEntered(MouseEvent e)
    e.getSource().method1();
    }

    By the way, MouseEvent is a subtype of ComponentEvent, so it has the method:
    Component comp = evt.getComponent();which is convenient if "method1" is a Component method.
    Another btw: the "adapter" classes allow you to write listeners without cluttering your code with empty method bodies:
    class Over extends MouseAdapter  {
        public void mouseEntered(MouseEvent e) {
    }

  • How to get String object from integer

    Hi,
    I am getting some problem with checking for equality. I had a primitive integer. How to convert it into String object?

    Please consult the javadocs:
    java.lang.Integer.toString(int i)
    will do it.
    "I am getting some problem with checking for equality" - elaborate.

  • How to get the objects from a workflow item's container

    Dear all,<P/>
    We need to get the value of a variable in the container of a workflow item. I can get the workflow item list using function module <B>SAP_WAPI_CREATE_WORKLIST</B>. Then how can I get the corresponding container elements' value?<P/>
    I tried function mofule <B>SAP_WAPI_GET_OBJECTS</B>, but the returned table <B>OBJECTS</B> and <B>OBJECTS_2</B> are both empty.<P/>
    Thanks + Best Regards<P/>
    Jerome<P/>
    null

    Hi,
    Well, I think you will be getting the value as BORNAME:BORKEY. Get the KEYVALUE into your local variable. And use the <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4acef453d11d189430000e829fbbd/frameset.htm">BOR Macros</a> to get the instance and desired contents.
    Regards
    <i><b>Raja Sekhar</b></i>

  • How to get GPIB address from VISA resource

    Hi All,
    Is there a way (CVI API) to get the GPIB address of a GPIB instrument from an alias or a VISA resource name defined in MAX?
    Thanks,
    Rick.

    Thanks mkossmann, I was actually looking for an api that would get the gpib address from the visa resource name defined in MAX which has already scanned in the gpib instruments.
    I guess it may not be good that way even if there's such an api because instrument gpib address might get changed and if MAX has not been asked to rescan then the address will be out of sync.

  • How to get dom object from acrobat pdf

    I am following the the document "PDF Accessibility API Reference" and following the section "Reading PDF files thru DOM Interface". There he mentions about including
    AcrobatAccess.h, AcrobatAccess_i.c and IPDDom.h. Please let me know where I can find these files. Also, How can I get a dom object to start with. If you have a sample code to share, that would be great. I tried googling about these but was not very successful in getting this info.
    Any help towards this is appreciated.

    Hi Leonard,
    I think there is something called GetCaret function mentioned in DOM interface which basically returns IPDomNode underneath caret. Also, in Accessibility side, accHitTest() function is there.
    I think today when I explored our product, some body has written wrappers over accessibility apis to get some good information. Anyways thank you very much for all your replies.
    One last question before I leave home:-)
    I have accessibility object representing a active page (page which is visible). Now using accessibility apis, I can traverse the tree of accessbility objects that belong to/Underneath page. Now to get the same on a different invisible page, what should I do. Calling getParent at a page level accessibility object returns null? SOmething like I want an accessibility object whose children are "the all the pages of the document".

  • How to get oc4j version from Java program

    i have the following in my Java Program
    Runtime r = Runtime.getRuntime();
    Process p = r.exec("java -jar oc4j.jar –version");
    and then i try to read the InputStream from the Process p.
    but this line is not executing, it returns the following error.
    Unknown switch: ?version, type java -jar oc4j.jar -? for help
    if i change it to ----------
    Runtime r = Runtime.getRuntime();
    Process p = r.exec("java -jar $ORACLE_HOME/j2ee/home/oc4j.jar –version");
    then i get another error :
    Exception in thread "main" java.util.zip.ZipException: No such file or directory
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:112)
    at java.util.jar.JarFile.<init>(JarFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:65)
    but if i cd to /oracle/j2ee/home and then run the command java -jar oc4j.jar –version, then it gives me the right output with the right version, but for some reason the samething from inside the java program is giving me errors,
    please help. i just need to read the oc4j version running on the server and display it in JSP.

    Process p = r.exec("java -jar oc4j.jar –version");The character before "version" should be a hyphen; yours is not.
    Process p = r.exec("java -jar $ORACLE_HOME/j2ee/home/oc4j.jar –version");
    then i get another error : Exception in thread "main"
    java.util.zip.ZipException: No such file or directory
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:112)
    at java.util.jar.JarFile.<init>(JarFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:65)One more problem here: $ORACLE_HOME will be not be interpreted in the runtime.exec even if it is defined as an environment variable. So you get an error that tells you oc4j.jar is not found.
    Hope this helps you.

  • How to get IP address from java applet

    is there anyway to find the IP address of a person who is on java applet on some chatting website (not me, but the other users)...... well, this question may sound stupid, but am actually new to this, so please help.
    :)

    >
    is there anyway to find the IP address of a person who is on java applet on some chatting website (not me, but the other users)...... >Sure. Ask whoever it is you are chatting to.. "wots ur ip?". Do not be surprised when they 'tell you where to go'.

  • How to get a value from JavaScript

    How to get return value from Java Script and catch it in c++ code. I have tried following code, but its not working in my case.
    what I want is if it returns true then call some function if it returns false then do nothing, so how to get those values in c++
    ScriptData::ScriptDataType fDataType = resultData.GetType();
    if (fDataType == kTrue)
           CAlert::InformationAlert("sucess");
           //call some function
                        else
                                  CAlert::InformationAlert("Error");
         // do nothing
    JavaScript Code:
        if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
               alert(value);
                return true;
      else
               alert ("SORRY");
               return false;

    How to get java script result into JSResult i m not getting it.
    I have wriiten follwing code in c++ :
              WideString scriptPath("\\InDesign\\Source1.jsx");
              IDFile scriptFile(scriptPath);
              InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
              if(scriptRunner)
                        ScriptRecordData arguments;
                        ScriptIDValuePair arg;
                        ScriptID aID;
                        ScriptData script(scriptFile);
                        ScriptData resultData;
                        PMString errorString;
                        KeyValuePair<ScriptID,ScriptData> ScriptIDValuePair(aID,script);
                        arguments.push_back(ScriptIDValuePair);
                        PMString paramkeyname1;
                        Utils<IScriptArgs>()->Save();
                        Utils<IScriptArgs>()->Set("paramkeyname1",scriptPath);
                        Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner,script,arguments,resultData,erro rString,kFalse);
                        Utils<IScriptArgs>()->Restore();
                        ScriptData::ScriptDataType fDataType = resultData.GetType(); // here i should get true or false which i m passing it from javascript code......not as s_boolean
                        if (fDataType == kTrue)
                                       //CAlert::InformationAlert("sucess");
                                     iOrigActionComponent->DoAction(ac, actionID, mousePoint, widget);
                        else
                                    this->PreProcess(PMString(kCstAFltAboutBoxStringKey));
    Java script code:
    function main()
           var scrpt_var;
           var scriptPath,scrptMsg;
           var frntDoc=app.documents[0];
           if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
                alert(value);
                 return true; // i want this value i should get in c++ code...How to get these values in c++
           else
              alert ("Error");
              return false; // i want this value i should get in c++ code...How to get these values in c++

Maybe you are looking for

  • Return order creation.

    Hi, Expert,, My issue: 1 ) I had create sales order for 2 Quantity. 2 I had completed PGI for 2 Quantity 3 ) I had complleted billing for this 2 Quantity, But after billing customer want to return, then 1 ) I had created return order with references

  • Query in a large xml file

    Hello, I'm trying to work with very large xml files which are created from csv files. These files may be very large - up to 1 GB ! Untill now I have managed to do several validations on these big xml files, and the only thing that works for me is SAX

  • Junk Characters are coming in the Print Preview of True Type Font

    Hi I am facing one issue. Here I have installed on one of the True type font of Gujarati (one of Regional language for India) language.When I see Print preview using LP01 Output device (which has SWIN Device Type) these true type font coming as Junk

  • Page Break Before / After

    Hello All, In MS Office word, Insert > break made to page break. In the Report, I have challenges in the Page Break Before / After. If any one help me out, it will be great. Thanks in advance, REF: Tool Property Inspector Object Navigator Report Edit

  • The number pad on my wirelss keyboard has stopped working...help!

    Hi All, New to macs, I have a new interl-based iMac with a wireless keyboard and mouse. Yesterday the number pad stopped working. The CD eject and sound buttons still work, but the numbers themselves do not - in fact when I use them, the whole machin