Creating java sources

My Oracle version is 10.2 eneterprise edition on RHEL 5
The below code is a working code .It fails in my machine showing error .
Can some one tell why
CREATE or replace JAVA SOURCE NAMED "MyTimestamp"
AS
import java.lang.String;
import java.sql.Timestamp;
public class MyTimestamp
public static String getTimestamp()
return (new Timestamp(System.currentTimeMill is())). toString();
ERROR at line 1:
ORA-29536: badly formed source: Encountered "is" at line 7, column 51.
Was expecting one of:
"instanceof" ...
">" ...
"<" ...
what's the mistake i am doing

I tried your code and got the same error. Then noticed that you have some spaces in {font:CourierNew}"System.currentTimeMill is())). toString();"{font}. One space after "Mill" and one before the toString.
I removed that and it worked for me
me@mydb> CREATE or replace JAVA SOURCE NAMED "MyTimestamp"
  2  AS
  3
  4  import java.lang.String;
  5  import java.sql.Timestamp;
  6  public class MyTimestamp
  7  {
  8          public static String getTimestamp()
  9          {
10                  return (new Timestamp(System.currentTimeMillis())).toString();
11          }
12  };
13  /
Java created.-Shreyas.

Similar Messages

  • Loadjava fails; create java source succeeds

    When using loadjava to load a Java class into the database I receive the following error:
    C:\OEMNT\bin>loadjava -user us/pw@db -verbose -resolve HelloWorld.class
    initialization complete
    loading : HelloWorld
    Error while loading HelloWorld
    ORA-00942: table or view does not exist
    creating : HelloWorld
    Error while creating class HelloWorld
    ORA-29506: invalid query derived from USING clause
    ORA-00942: table or view does not exist
    resolver :
    resolving: HelloWorld
    Error while resolving class HelloWorld
    ORA-04043: object HelloWorld does not exist
    loadjava: 3 errors
    When using the CREATE JAVA SOURCE command from SQL the Java source + Class is created without problems.
    It seems loadjava wants to insert or check something in a table. But what table?

    Hi,
    Omitting -jarasresource is the first step.
    You probably need to specify -recursivejars in cas there are jars in your jars.
    Also use -genmissing option in case some classes are still missing in the jars files you've loaded.
    Kuassi http://db360.blogspot.com

  • JAVA NOT INSTALLED.. error while creating java source

    Hi All,
    I am trying to create java sources in oracle database lke
    create or replace and compile java source named rnp as
    public class RNP as
    import java.util.GregorianCalendar;
    public class calcrnp {
    But it is throwing an error : JAVA NOT INSTALLED..
    I am not getting any clue regarding this...
    Can any please help me..
    Thanks
    Ashok

    How about
    create or replace java source named "rnp" as
    import java.util.GregorianCalendar;
    public class calcrnp {
    /K.

  • Problem with creating JAVA Source. please help

    Dear all
    how are you.
    In fact I have made a simple java class that return a string which represents the screen size . for example 800/600 or 1024/768 or others
    but I face error ORA-29541 class string.string could not be resolved
    This what i made
    first i created my JAVA Source
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ScreenProperty" AS
    import java.lang.Object;
    import java.awt.*;
    public class ScreenProperty
    int w;
    int h;
    public static String getScreenSize()
    w = Toolkit.getDefaultToolkit().getScreenSize().width;
    h = Toolkit.getDefaultToolkit().getScreenSize().height;
    return w+"/"+h;
    SQL>Operation 160 succeeded.
    this means the the java source created successfuly
    and I'm sure that my java code is correct
    then i created a fuction to call this java source as fellow
    SQL> create or replace function f_get_screen_size
    return varchar2
    as language java
    name 'ScreenProperty.getScreenSize() return java.lang.String';
    Function created.
    the I Issued this sql statement to return the result that should be varchar2 that represent the sceen size(1024/768)
    SQL> select f_get_screen_size from dual;
    ORA-29541 class string.string could not be resolved.
    I do not know what is the reason for this error
    and when i searched the documentation for this error i found
    ORA-29541 class string.string could not be resolved
    Cause: An attempt was made to execute a method in a Java class that had not been previously and cannot now be compiled or resolved successfully.
    Action: Adjust the call or make the class resolvable
    I need to know what is the problem.
    And is there another way to load this class other than making JAVA SOURCE
    please help

    before drawing hands of clock you could fill a circle/oval with certain color, then you'd have that kind of circle that has been filled as backgound.
    you may change those dots to be small lines for 12, 3, 6 and 6 o'clock and then have small dots represent 1, 2, 4, 5, 7, 8, 10 and 11 o'clock
    anyhow, you should study that code and see how you can modify it whitout breaking it but having it look different.
    better yet would be trying to understand how it works, what any line there means and then recreate your own... this way you would learn more....
    and if there are some methods or anything you don't understand, then look them up from API documentation
    good luck.

  • Help on creating java source code

    I am new to java, and I have the java 1.4.2 and java 5.0 and I am having problem creating programs that will allow a user to run a program that requires their input. I can not find the class or package that needs to be imported and instiated for this to be possible....

    Using the System.in stream, you can easily grab command-line input from the user.
    import java.io.*;
    public class Example {
         public Example() throws IOException {
              BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
              System.out.print("What is your name? ");
              String name = b.readLine();
              System.out.println("You entered: \""+name+"\"");
         public static void main(String args[]) {
              try {
                   new Example();
              catch (IOException e) {
                   e.printStackTrace();
    }

  • How to use java source in Oracle when select by sqlplus.

    How to use java source in Oracle when select by sqlplus.
    I can create java source in Oracle
    import java.util.*;
    import java.sql.*;
    import java.util.Date;
    public class TimeDate
         public static void main(String[] args)
    public String setDate(int i){
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(new Date((long)i*1000));
    System.out.println("Dateline: "
    + calendar.get(Calendar.HOUR_OF_DAY) + ":"
    + calendar.get(Calendar.MINUTE) + ":"
    + calendar.get(Calendar.SECOND) + "-"
    + calendar.get(Calendar.YEAR) + "/"
    + (calendar.get(Calendar.MONTH) + 1) + "/"
    + calendar.get(Calendar.DATE));
    String n = calendar.get(Calendar.YEAR) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.DATE);
         System.out.print(n);
         return n;
    I have table name TEST
    ID DATE_IN
    1 942685200
    2 952448400
    When I write jsp I use method setDate in class TimeDate
    The result is
    ID DATE_IN
    1 1999/11/16
    2 2003/7/25
    Thanks you very much.

    It is unclear where you are having a problem.  Is your issue at runtime (when the form runs in the browser) or when working in the Builder on the form?
    Also be aware that you will need to sign your jar and include some new manifest entries.  Refer to the Java 7u51 documentation and blogs that discuss the changes.
    https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias
    http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html

  • How to view record from java source table

    hi,
    i had created a table as
    CREATE JAVA SOURCE NAMED "Hello" AS
    public class Hello {
    public static String hello() {
    return "Hello World"; } };
    also it compiled but i dont've idea to view the record from it
    can u help me

    Please check the following script --
    create or replace and resolve java source named "Hello"
    as
    import java.io.*;
    import java.sql.*;
    import java.math.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    public class Hello extends Object
        public static String Display()
        throws IOException
            return "Hello World";
    create or replace procedure Hello(v_str  out varchar2)
    is
       language java
       name 'Hello.Display(java.lang.String) return String';
    create or replace procedure HDisplay
    is
    x  varchar2(400);
    begin
      Hello(x);
      dbms_output.put_line('String is: '||x);
    end;And, from sql prompt --
    exec HDisplay;N.B.: Not Tested...
    Regards.
    Satyaki De.
    Message was edited by:
    Satyaki_De

  • Viewing Java Source File

    Why do we get a line saying 'create or replace' at the top when viewing java source shouldn't this read, as a minimum, 'create java source named "java object name" as'

    Bump
    I'm also still getting this in 919; any response from the team?
    thanks,
    William

  • Decompilation errors java source "java/sql/Date"

    Hi,
    I've decompiled a Contoller file and inside the new created java source file
    there is a line like
    <b>
    Class aclass2[] = {
    java/sql/Date, java/lang/Integer, java/lang/String, java/lang/String
    </b>
    But this line can't be compiled in a new file version. What is the equivalent to this or how can I change it, so that
    the java file can compiled properly.
    Thanks a a lot and regards
    Robert
    Edited by: user2979718 on 17.05.2010 02:05

    Hi Robert,
    Try with Class aclass2[] = {
    java.sql.Date, java.lang.Integer, java.lang.String, java.lang.String
    Hope this will resolve your issue.
    Regards,
    Reetesh Sharma

  • How can I share a *.java source file across multiple projects in NetBeans?

    I'm sure this simple and a pretty common operation but how can I share a *.java source file across multiple projects in NetBeans? Right now I keep cut, coping and pasting the same source file between multiple projects to re-use the same code. But I could I make this source file a library file or something like that so that I could access it from any project. I assume this would be a generic operation but I mentioned NetBeans for clarity. Thanks.

    fiebigc wrote:
    I know I mentioned NetBeans but I'm most interested in the generic method for creating a library of source files that I can call into whatever program I am developing. I've done such a thing in C using header files and such but I'm trying to get a direction on how this is accomplished in Java. I'm sorry if I could edit the title I would. If anyone wants to be specific about NetBeans I welcome that too.
    Edited by: fiebigc on Jun 20, 2008 5:57 PM
    >I know I mentioned NetBeans but I'm most interested in the generic method for creating a library of source files that I can call into whatever program I am developing. I've done such a thing in C using header files and such but I'm trying to get a direction on how this is accomplished in Java. I'm sorry if I could edit the title I would. If anyone wants to be specific about NetBeans I welcome that too.
    Edited by: fiebigc on Jun 20, 2008 5:57 PM
    Create a class library.
    Write your code, compile it to .class files, put those class files in a .jar file and include the jar file in the classpath whenever you want to compile a project against it.

  • How to create java classes when multiple xsd files with same root element

    Hi,
    I got below error
    12/08/09 16:26:38 BST: [ERROR] Error while parsing schema(s).Location []. 'resultClass' is already defined
    12/08/09 16:26:38 BST: [ERROR] Error while parsing schema(s).Location []. (related to above error) the first definition appears here
    12/08/09 16:26:38 BST: Build errors for viafrance; org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.1:generate': Mojo execution failed.
    I tried genarate java classes from multiple xsd files, but getting above error, here in .xsd file i have the <xe: element="resultClass"> in all .xsd files.
    So I removed all .xsd files accept one, now genarated java classes correctly. but i want to genarte the java classes with diffrent names with out changing .xsd
    Can you please tell me any one how to resolve this one......
    regards
    prasad.nadendla

    Gregory:
    If you want to upload several Java classes in one script the solution is .sql file, for example:
    set define ?
    create or replace and compile java source named "my.Sleep" as
    package my;
    import java.lang.Thread;
    public class Sleep {
    public static void main(String []args) throws java.lang.InterruptedException {
    if (args != null && args.length>0) {
    int s = Integer.parseInt(args[0]);
    Thread.sleep(s*1000);
    } else
    Thread.sleep(1000);
    create or replace and compile java source named "my.App" as
    package my;
    public class App {
    public static void main(String []args) throws java.lang.InterruptedException {
    System.out.println(args[0]);
    exit
    Then the .sql file can be parsed using the SQLPlus, JDeveloper or SQLDeveloper tools.
    HTH, Marcelo.

  • How to browse Java Source in PL/SQL Developer

    As I use PL/SQL Developer for developing, for the first time I've just tried to write and compile a java source.
    After compiling the java source succesfully, I can see it by selecting it from the system table USER_SOURCE where it's defined as TYPE JAVA SOURCE, but I'd like to know where and if it's possible to browse it in the left window list of the panel of PL/SQL Developer like it happens for Procedures, Packages, ... I mean is there a way to edit the java source created without selecting it from USER_SOURCE but in a better way as it's possibile for the procedures in PL/SQL Developer?
    Thanks

    Yes, It is possible. Check the option Tools->Browser. Then in the browser you can find it.

  • How to use a Java Resource in my java source

    Hello,
    I need to know how to use my external JAR I loaded in the database using this line below:
    CREATE OR REPLACE JAVA RESOURCE NAMED "MyJar" USING BFILE (BFILE_DIR,'MyExternal.jar');
    In fact, I have a Java file using this JAR, but I do not know how to tell to the java source that it have to use this JAR.
    ==========Java Source importing the Jar===================
    package com.gemalto.ws.snmp;
    import java.io.IOException;
    import java.util.Vector;
    import org.snmp4j.Snmp;
    import org.snmp4j.smi.*;
    import org.snmp4j.TransportMapping;
    import org.snmp4j.transport.DefaultUdpTransportMapping;
    import org.snmp4j.CommunityTarget;
    import org.snmp4j.mp.SnmpConstants;
    import org.snmp4j.PDU;
    import org.snmp4j.event.ResponseEvent;
    public class SNMPAgent
    ==========================
    Could you give the SQL request or loadjava command line permitting to do use my java resource file?
    Thks

    The JAR is already load by using CREATE JAVA RESOURCE ... or "loadjava -resolve –force -user p/p@SID –genmissing -jarasresource MyJar.jar"
    If we can create a resource by SQL or loadjava, how can I use it in my java code?
    Edited by: 847873 on 28 mars 2011 06:05
    Edited by: 847873 on 28 mars 2011 06:07

  • Java web service -- how to re-generate Java sources when WSDL changes?

    I created a new web service using the "Java Web Service from WSDL" wizard.
    Some time later I changed the WSDL and now I need to rebuild the Java sources. What is the best way to do this? I can't re-run the wizard, it returns an error: "The name of this web service is already used by another web service in this project."
    Using Jdeveloper 11.1.1.3.0 on Linux.
    Thanks.

    These links may helpful for you.
    http://download.oracle.com/docs/cd/E14004_01/books/SSDev/SSDev_CustomizingModel22.html
    http://download.oracle.com/docs/cd/B31017_01/core.1013/b28764/web_services003.htm

  • Error in creating Java Users during Solution Manager installation

    Hi gurus,
    First time trying to install SAP.
    Red Hat Linux 4
    Oracle
    jdk 1.4.2_11
    While installing the Solution Manager, it errored when it was creating Java Users, SAPJSF, J2EE_ADMIN and J2EE_GUEST.
    The error description read "jco$exception: rfc_error_system_failure: invalid request".
    I want to create these users manually and continue with the rest of process.
    I searched lots of entries, notes, etc., but somehow, my "old" pair of eyes (and brains, too) failed to come up with something I could understand.
    So, gurus, please help, help, help!!
    There are no GUI version of anything installed, no Virtual Admin, no nothing like that. I have to rely on good old unix (Linux) command to do (add users) this.
    Can you please, please post the instructions (step-by-step)? Please have a pity on me since this is my very first time dealing with SAP.
    Thanks and regards.

    Creating users manually is not the intension of the SAP Installation tool. There are other solutions available
    A good starting point is to check if SELinux is enabled or disabled. I've seen lots of broken installations on Red Hat because SELinux does not allow the installer to create users. Check if in /etc/selinux/config  the setting
    SELINUX=disabled
    is set.
    I see, that you are using JDK 1.4.2_11. Is this the Sun JDK? In case you are on x86_64 you have to use the IBM JDK instead. You can download it from <a href="https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=lxdk&S_PKG=amd64142sr7&S_TACT=105AGX05&S_CMP=JDK&lang=en_US&cp=UTF-">here</a> .
    Also a new SAPINST may help. The current Installation Master CD can you download here:
    http.//service.sap.com/swdc
    -> Download
    -> Installations and Upgrades
    -> Entry by Application Group
    -> SAP Technology Components
    -> SAP SOLUTION MANAGER
    -> SAP SOLUTION MANAGER 3.2/4.0
    -> Installation and Upgrade
    -> LINUX
    -> ORACLE
    51032006       SAP Solution M. 4.0 SR1 Inst. Master **
    Best Regards,
    Hannes Kuehnemund

Maybe you are looking for

  • ALV to EXCEL along with the color

    Hello,       Is it possible to download an ALV report output to an EXCEL along with the color in the ALV report.I made an ALV report with some rows having red color depending on a bussiness logic. When user downloads the ALV report to excel from stan

  • Image Gallery/Portfolio

    Hey there.. Can anyone tell me how to edit the attached actionscript to do the following: 1) Use the 'url' field from the xml file so that when a link exists, when the user clicks on the image it takes them to that link. 2) Remove the functionality t

  • Table name and filed name from a scrren fiels

    I'm using Oracle Forms 10g I have 2 screen fields named :TABLE_NAME & :COLUMN_NAME I wrote a trigger 'SELECT :COLUMN_NAME INTO :F FROM :TABLE_NAME;' and this syntax is not accepted; I'm trying to get the field name and the table name from the screen

  • Under music, artists-tunes from one album are divided in two, How do I get them together?

    Song are divided, How do I them together?

  • Edits in Lightroom 5-then in Photoshop CC -back to Lightroom

    Hi, Hope you can help. 1) Imported a raw image from camera (converted to dng) into lightroom 5. 2) performed some edits in the "Develop" module. 3) Did some further external edits in Photoshop CC-by switching to Photoshop CC trough Lightroom -"edit i