Setting the classpath of the JVM for OC4J

Is there any way to add a path to the classpath when the embedded OC4J is run? Although the OC4J is finding my classes, the Oracle JDBC driver isn't. Here's a bit more info:
I've been having a bit of a problem getting database java objects ("CREATE TYPE...EXTERNAL NAME...LANGUAGE JAVA USING SQLData") instantiated on the client.
- I have an object table of type t_my_type with Java class "mypackage.MyType".
Code sample:
ResultSet rs = myStatement.executeQuery(
"SELECT VALUE(p) FROM my_type_table p" );
rs.next();
rs.getObject( 1 );
Exception in thread "main" java.sql.SQLException:
Inconsistent java and sql object types:
ClassNotFoundException: mypackage.MyType
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at
oracle.sql.JAVA_STRUCT.toJdbc(JAVA_STRUCT.java:108)
... ad nauseum
And yet when I add "-classpath /path/to/mypackage" it works fine. HOWEVER, I don't know how to add it to the OC4J startup classpath (marked "HERE" below? -- not application.xml, the one that you see in the "Log" window in jDeveloper):
java \
-server \
-Xdebug \
-classpath /path/to/oc4j/oc4j.jar:<HERE> \
Incidentally, I'm also interested in having the Database send me the bytecode for the class ITSELF instead of having to also have a copy of the .class/.jar on the client side as well.
Any help would be appreciated. Thanks.

The simplest way to do this is to copy classes12.zip to the WEB-INF/lib directory. The JSP should then find this automatically.
As a side note, that is an ancient JDBC driver - you might want to upgrade to something from this millennium.

Similar Messages

  • Setting the CLASSPATH from the JVM by a class

    Hy experts
    I have an application thats searching a jar file and have to access classes from this jar file.
    There are two ways to do this:
    1.
    Loading the jar file byte by byte and create the classes to load them into memory. This is the hard way.
    2.
    Setting the CLASSPATH variable in the running program! Thats the easy way! May how does it works?
    Is there any possiblity to set the classpath in a running application or only in the shell?
    Thanks for help
    konrad

    the classpath is readin when you run the JVM ie issue the 'java' command, the environment cant be altered to update a new classpath. However, why not just put the files you wish to load at runtime within the current classpath you've setup. If you use the System.loadLibrary(), you should be able to pick up the classes you wish to readin at run time via this approach.
    good luck
    rob

  • Setting the classpath of classes12.zip for Tomcat

    Hi
    I am using Apache Tomcat webserver and while trying to run a jsp page which intializes oracle.jdbc.driver.OracleDriver it throws an error
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    Please suggest how to set the classpath of classes12.zip in Apache Tomcat
    My Code Snippett
    <%@ page import="java.util.*,java.sql.*,javax.servlet.*"%>
    <body>
         <%
         Connection con ;
         ResultSet rs ;
         Statement stmt ;
         ResultSetMetaData rsmd ;
         try{ 
         Class.forName("oracle.jdbc.driver.OracleDriver");
         catch(Exception e)
         out.println(e);//print the exception on the command prompt
    %>

    The simplest way to do this is to copy classes12.zip to the WEB-INF/lib directory. The JSP should then find this automatically.
    As a side note, that is an ancient JDBC driver - you might want to upgrade to something from this millennium.

  • How to set the Classpath of the Manifest to use jars which are included?

    Hi,
    I want to set the classpath for jars which are included in another jar, wihich I want to execute. At the moment I unzip them and include them afterwards, but there should be a more handy way to do this.
    Please post an example of a Classpath declaration for the Manifest, assuming the jars are at the top level of the archive.
    If it shouldn't be possible do that, please explain me why.
    Perhaps it might be diffuclt for java to decide if a classpath location starts with the current-dir or the current-jar, but I assume that there is a special syntax to sort out such probems.
    Thanks a lot in advance.
    Greetings Michael

    Java's classloader doe not support jars within jars. There are some 3rd part solutions, one is "one jar" at sourceforge. Search for others.

  • How to config the CLASSPATH in Win2000 server for JDBC(oracle.jdbc.driver,*)

    I am using the OS: Win2000 Server.I need to connect to some remote DataBase,but I
    don't know how to config the driver in the CLASSPATH environment variable, my Problem is: when I import the oracle.jdbc.driver.OracleDriver ,and run the program, it warns to me that it cannot find the class,and i know i didnot config the CLASSPATH in environment variables, so I want someone to tell me how to config it ,and where should the file "class12.zip" be placed !
    Thank you! maybe the problem is a piece of cake for you ,but now i do not know how to deal with it!

    Hi ,
    try this,
    http://myjdbc.tripod.com/basic/jdbcurl.html
    Regards
    Elango.

  • Define the classpath in the debugger!

    I know how to set the classpath for the internal/external compiler and it works fine.
    but when I tried to debug my application, it could not find the classes for the Database driver.
    I tried to do the same thing I did when I defined the classpath for the external compilation, and point the class path to driver jar. and it works fine.
    but I could not find a place where I include the drivers in the class path for the default debugger.
    Can any one help!?
    if not. thanks in advance anyway :)

    " Within the IDE, your classpath is defined by the filesystems mounted in the Filesystems tab of the Explorer. If you need additional libraries mounted, you can mount them and set various properties to determine whether they're visible in explorer, whether they're used for execution, compilation or debugging (for example, one does not want to recompile all of Swing, but it's quite useful to mount the sources and be able to trace into them when debugging).
    To set these capabilities, right click on the root of a mounted filesystem and choose Customize from the popup menu. You will see a property sheet where you can determine how the classes will be used. "
    http://forte.sun.com/cgi-bin/WebX?[email protected]@.ee7401e
    -M

  • Packaging files outside of the classpath in the Air Install Badge

    Perhaps I am just missing it, but I notice when you bundle a
    Flex app into an Air container, you don't have an option to package
    assets that are outside of the src classpath? I see that the
    packaging process allows you to navigate to files under the /src
    tree but what about files outside of that structure?
    Suppose I want to distribute assets outside of the swf and
    have then distributed along with the application. Is this native
    functionality or will a commercial installer be a necessity?

    There is an option in the project settings to add additional
    source folders to the project. And if none of the built-in Flex
    Builder features do what you need, you can certainly package other
    assets using the underlying ADT tool (which Flex Builder uses). The
    only thing you can't do is install assets outside the application
    directory or run other installation programs -- although you could
    copy files elsewhere on the first run of an application.

  • Not able to load jspx file from the classpath in Integrated OC4J

    Hi,
    I am using integrated OC4J from my jdeveloper to deploy my application as an ear file. It contains one jar file (with ejb deployment desscriptors) and a war file (including Model and Viewcontroller project contents).
    The war file contails a jspx file (say Test.jspx) which contails a link to another jspx file (say Remote.jspx) which resides in its WEB-INF/lib directory.
    When I load Test.jspx and click on the link, it fails to look for the Remote.jspx. It displays a message "OracleJSP error: java.io.FileNotFoundException:" on the web browser.
    From the message written to log file, found that it is actually trying to search for Remote.jspx file in the current context.
    Also tried including the classpath to the jar file containing the Remote.jspx file in orion-web.xml of the web application. using the following:
    <classpath path="file:/xxx/yyy.jar" />
    The issue is still there even after this.
    Can anyone suggest me how to achieve this?
    Thanks,
    Aparna

    this.getCodeBase(), would get RSPL / RLog or whatever you have in your codebase (html parameter of
    the OBJECT/APPLET(:hope not) tag.
    URL u = new URL(this.getCodeBase(), "../something.jpg");
    would get RSPL/something.jpg
    URL u = new URL(this.getCodeBase(), "../VIRA/JPG/00/1.jpg");
    would get RSPL / VIRA / JPG / 00 / 1.jpg
    If you are not sure what your codebase is your can print it out:
    System.out.println(this.getCodeBase().toString());

  • How to set the classpath in CVM?

    Hi everybody,
    experimenting with the J2ME Personal Profile Runtime Environment on a Linux PC I wonder how to set the classpath. The command line options only allow me to set the bootclasspath.
    My original problems deals with determining the codebase for a class that is contained in a jar.
    1) If I put this jar into the bootclasspath, that class is found and can be loaded, but the codebase (retrieved using class.getProtectionDomain().getCodeSource) is NULL.
    2) If I put it into the classpath by using the command line option -Djava.class.path=... the class cannot be found by the ClassLoader.
    3) If I put the jar into both, the classpath and the bootclasspath, the latter one is applied and result 1) shows up.
    Any idea how to work around this?

    @see http://forum.java.sun.com/thread.jsp?forum=8&thread=410868

  • How to set the CLASSPATH in Unix Server

    Hi, everyone~
    Do anyone noe how to set the CLASSPATH in the hp-ux server? I tried the setenv CLASSPATH, but not working.. I think should use export. But my jsp pages still cannot working, dunnoe y?
    I wonder is the hp-ux support jsp and servlet or not?
    In order to let the jsp and servlet to run properly in the unix server, what kinds of steps should taken ?
    Hope somemore who experience with this situation b4 can give me some guidance.. Thanks~~
    regards,
    tzeyik

    Tomcat ignores any and all CLASSPATH environment variables. Even if you could figure out how to set it, Tomcat wouldn't use it.
    Better to learn how Tomcat's CLASSPATH works and how to deploy Web apps properly. - MOD

  • How can i set the classpath??

    CAN ANYONE PLEASE HELP ME HOW TO SET THE CLASSPATH IN WINDOWS ME ,WHAT IS THE RIGHT CODE TO SET THE CLASSPATH I AM USING JDK1.3 VERSION.
    THANK YOU VERY MUCH
    ERICK LUCCIO

    Try this way Start->Program->System tools-> System Summary>startup .Try to find the variable classpath,make sure the path is correct.The classpath contain the the *.java & *.class you save. I'm also new in java .This path & classpath question is so trouble to me .Now i'm running jdk1.3.1_2 in WINME ,WINNT AND WIN2000 IN no problem.........

  • Setting classpath from the command prompt

    each time i try to set the classpath from the command prompt it is not always well done . can someone give a good format
    i.e set classpath = ;c:\document and settings\ luke

    each time i try to set the classpath from the command
    prompt it is not always well done . can someone give
    a good format
    i.e set classpath = ;c:\document and settings\ lukeThe best way is not doing it at all.
    Anyway, try:
    set classpath = ".;c:\document and settings\luke"

  • Java -jar Test.jar  option is not identifing the CLASSPATH on UNIX BOX

    Hi All,
    java -jar Test.jar
    I am trying to execute Test.jar file using -jar option. I am able to excute the Test.jar file but it is not identifing the CLASSPATH set for other JAR files which is used in part of Test.jar. Saying java.lang.NoClassDefFoundError: for the class which are set in CLASSPATH.
    The same is able to identify the CLASSPATH if i excute the Test.class file directly with out -jar option like
    java Test. In this case everything is working fine.
    Can any one tell me why it is not identifying the classpath if i use or execute with java -jar Test.jar option.
    Thanks,
    sha

    When you use the -jar option, the only classpath that is used is the Class-Path in the manifest file of the jar. If there is no Class-Path, then only the jar is searched for classes. If there is a Class-Path, the paths must be relative to the jar file.

  • How to point the classpath to "CLASSPATH" system variable?

    Hi Experts!
    I'm trying to create a web dynpro application for sending a simple email using the tutorial that can be found here.
    I was actually able to make the program work using Java Swing, but not in my web dynpro implementation.
    According to the tutorial, the jar files should be located at "CLASSPATH" system variables to make things work.
    When I tried printing the URL of the classpath of the web dynpro app, it is pointing to a different location from what I have defined in the system.
    I have created the "CLASSPATH" system variable at "C:\CLASSPATH\lib" with the jar files on it. Here's the correct classpath using my swing application:
    /C:/CLASSPATH/lib/commons-beanutils-1.8.3.jar
    /C:/CLASSPATH/lib/commons-codec-1.4.jar
    /C:/CLASSPATH/lib/commons-collections-3.2.1.jar
    /C:/CLASSPATH/lib/commons-configuration-1.7.jar
    /C:/CLASSPATH/lib/commons-digester-1.8.1.jar
    /C:/CLASSPATH/lib/commons-httpclient-3.1.jar
    /C:/CLASSPATH/lib/commons-lang-2.6.jar
    /C:/CLASSPATH/lib/commons-logging-1.1.1.jar
    /C:/CLASSPATH/lib/ewsjavaapi-1.1.5.jar
    /C:/CLASSPATH/lib/javamail-ews-bridge-0.0.8.jar
    /C:/CLASSPATH/lib/jcifs-1.3.15.jar
    /C:/CLASSPATH/lib/mail-1.4.jar
    /C:/CLASSPATH/lib/slf4j-api-1.6.4.jar
    But the web dynpro app is pointing at different directories.
    @Printing project classpath...
    /E:/usr/sap/GOS/J03/exe/jstart71.jar
    /E:/usr/sap/GOS/J03/exe/sapjvm_5/lib/jvmx.jar
    /E:/usr/sap/GOS/J03/exe/sapjvm_5/lib/jvmx_tools.jar
    /E:/usr/sap/GOS/J03/exe/jre/lib/iqlib.jar
    /E:/usr/sap/GOS/J03/exe/sapjvm_5/lib/tools.jar
    /E:/usr/sap/GOS/J03/j2ee/cluster/bin/boot/sap.com~tc~bl~jkernel_boot~impl.jar
    /E:/usr/sap/GOS/J03/j2ee/cluster/bin/boot/jaas.jar
    /E:/usr/sap/GOS/J03/j2ee/cluster/bin/system/sap.com~tc~bl~bytecode~library.jar
    /E:/usr/sap/GOS/J03/j2ee/cluster/bin/boot/memoryanalyzer.jar
    This is the code I used for printing the classpath:
    ClassLoader cl = ClassLoader.getSystemClassLoader();
    URL[] urls = ((URLClassLoader) cl).getURLs();
    for (URL url : urls) {
        System.out.println(url.getFile());
    How can I set the correct classpath to the "CLASSPATH" system variable?

    Erwin,
    You wil need to add the jar files to a Library DC and then reference them in your Web Dynpro app.
    Take a look at this tutorial
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/006a6229-b1ed-2e10-0c8c-cc5673cf268f?QuickLink=index&overridelayout=true
    Stefan

  • I am having trouble with the classpath

    I use the jikes compiler, and I am having trouble setting my classpath. The current classpath I have is: C:\program files\java\j2re1.4.0_01\lib\rt.jar
    When I compile my Java file it says that it could not find the directory java/lang.
    I have the program Robocode and the compiler on it uses Jikes, and it works, but when I try to compile one of my files on either Jcreator or MsDos Prompt it doesn't work for me. Can anybody help me on how to set my classpath?

    take a look in the directory tree and see if javac is in it. when i have a path with jre in it, there isn't any compiler just the java runtime environment. you may need to install the jdk.

Maybe you are looking for