Newbie to Java

I'm writting a program for school and I know the answer is simple(I hope) I just can't see it. I'm using TextPad and I've been able to debug my programs with no problem - until now.
Here's the error I get:
unexpected type
required : variable
found : value
newencodeLine.charAt(n)='+';
^
newencodeLine is declared as a string and n as an integer. Our professor has us URL encoding a line of text.
Hope someone can help!!!
Jen

I can't tell whether you want to:
1. Read/extract the value of the character at position n of the string, or
2. Replace the character at position n of the string with a plus sign
To read, use: char charVariable = newencodeLine.charAt(n)
To replace, one of the replace methods of the String class might work for you, otherwise you'll need to use StringBuffer class, insert or replace method.

Similar Messages

  • [Newbie] Which JAVA API is a good choice for creating a game board?

    I'm a newbie in JAVA game programming.
    I would like to create a chess game for fun. I have a fairly good idea on how I want it to be, but I'm having some difficulty on the game board.
    I am not sure which set of JAVA API I should be using to design my board. I guess that the board will sits in the back, and in the front, there'll be my chess pieces that I can drag and drop.
    Should I be using JAVA Swing to do this? or JAVA 2D API? It will require some study for either one, so I figure I should pick a good one to learn.
    Thanks in advance! :-)

    Also if you would like to create a much simpler, 2D chess game, I would suggest you use the Swing API, which comes with Java from version 1.2 and on up. Naturally I would suggest at least using the latest 1.4 or 1.5 software development kit, because they have greater and more stable features, bug fixes and so on. I also would suggest you go to the library or Barnes and Noble nearest you, and pick up a book on Java. One recommendation that may be simpler to get an understanding of Java is from Deitel and Deitel: http://www.deitel.com/books/jHTP6/ though my beginner's Java book was geared directly toward how to program games (small games like memory, or tetris), though I can't remember what it was called. Anyway I believe it is very important to learn the basics of Java before you get into things that you may or may not understand. My opinion, so have a go at it.

  • Im a newbie in java and i need help. im a student

    im an I.T student in Adamson University here in the philippines i went here to ask help about our activity in school about java. our professor told us to make a program in java (btw were using netbeans) that will ask the user his birth year and then the output will tell the zodiac sign of the year entered. she told us (our prof) to make it using showInputDialog. and then to show the output we must use the JOptionPane.showMessageDialog.
    i try to do it but i found myself in trouble bcoz im new in java.
    i try to to it and here's what i did
    import javax.swing.JOptionPane;
    public class Zodiac;
    public static void main(String args[])
    String name=JOptionPane.showInputDialog("Enter your year of birth?");
    String message=String.format("Your zodiac sign is tiger");
    JOptionPane.showMessageDialog(null,message);
    i knew that i need to use conditional statements here but i dont know where to put it and how to declare the JOptionPane.etc.
    pls help me asap im a newbie.

    as you wish heres what i did. this is not a gui version
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package marlonestipona;
    * @author ESTIPONA
    import java.util.Scanner;
    public class Main {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int yr1;
    String tgr ="Tiger";
    String dog ="Dog";
    String rbt ="Rabbit";
    String ox ="Ox";
    String drgn ="Dragon";
    String rat ="Rat";
    String pig ="Pig";
    String rst ="Rooster";
    String hrs ="Horse";
    String shp ="Sheep";
    String mky ="Monkey";
    String snk ="Snake";
    System.out.print("Enter your birth year: ");
    yr1=input.nextInt();
    if (yr1==1974 || yr1==1986 || yr1==1998)
    System.out.printf("Your zodiac sign is %s!\n",tgr);
    }else if (yr1==1982 || yr1==1994 || yr1==2006){
    System.out.printf("Your zodiac sign is %s!\n",dog);
    }else if (yr1==1975 || yr1==1987 || yr1==1999){
    System.out.printf("Your zodiac sign is %s!\n",rbt);
    }else if (yr1==1973 || yr1==1985 || yr1==1997){
    System.out.printf("Your zodiac sign is %s!\n",ox);
    }else if (yr1==1976 || yr1==1988 || yr1==2000){
    System.out.printf("Your zodiac sign is %s!\n",drgn);
    }else if (yr1==1972 || yr1==1984 || yr1==1996){
    System.out.printf("Your zodiac sign is %s!\n",rat);
    }else if (yr1==1983 || yr1==1995 || yr1==2007){
    System.out.printf("Your zodiac sign is %s!\n",pig);
    }else if (yr1==1981 || yr1==1993 || yr1==2005){
    System.out.printf("Your zodiac sign is %s!\n",rst);
    }else if (yr1==1978 || yr1==1990 || yr1==2000){
    System.out.printf("Your zodiac sign is %s!\n",hrs);
    }else if (yr1==1971 || yr1==1991 || yr1==2003){
    System.out.printf("Your zodiac sign is %s!\n",shp);
    }else if (yr1==1980 || yr1==1992 || yr1==2004){
    System.out.printf("Your zodiac sign is %s!\n",mky);
    }else if (yr1==1977 || yr1==1989 || yr1==2001){
    System.out.printf("Your zodiac sign is %s!\n",snk);
    } else
    System.out.println("Invalid");
    now my problem is how to turn this whole code into gui using those dialog boxes.

  • Newbie to java(String[] args and String args[])

    what is the difference is it just that the arguments/parameters givven with the program are assigned to String (String[] args) or that they are assigned to args (String args[]) and why do you have to define the args part if yo don't assign something to it..
    might seem a dumb question, but hey, when i say i'm new at it i mean new!!!!

    Dear newbie,
    when one issues a command on dos prompt like
    c:\>java YourProgramName , then how would the program know where to begin executing the code. To make it standard and simple java.exe locates the method named main which has a particular signature that is , you can only define one main method as
    public static void main(String [] args){
    // remaining code
    1. public [Access Specifier ]This method has to be declared public because it will be accessed from outside the class by jvm.
    2. It is declared static because you are not allocating any memory to this class by the new operator for the main method to be executed by jvm. Only static methods and variables can be accessed without the need to create object of the class where they are defined. So when you say static, the jvm automatically allots memory to this method, accesses it and starts to execute the code declared in main method. All methods and variables (which are not defined static) have to be accessed by creating objects of the class in which they are defined.
    So if you have a class which has static main(String args[]) and another method int multiply() which is not static, then to use it in main you will have to create an object of the class where it is defined.
    public class yourClass{
      public int multiply(int a, int b){
       return a*b;
       public static void main(String args){
           System.out.println("Product of 5*6 = "+ 5*6 );
            // you can not say
            // System.out.println(multiply(4,5)); because multiply is not a static method and main can not access it directly so what you have to do is
         yourClass yourObject=new yourClass();
       System.out.println("Product is "+ yourObject.multiply(4,5));
    } 3 Return type is void because this method does not return any value.
    4. (String [] args) is equivalent to (String args []). Java has provided this functionality and what one is doing here by either statement is making a String array named args. "[]" before or after args just implies that the Variable args is of Type String Array.
    5. The Use of this signature for main method is that you can pass command line arguments which then your code can manipulate to give result, ie say if your main sums up two numbers
    //when hard coded
    public static void main(String args){
    System.out.println("Product of 5*6 = "+ 5*6 );
    //Using command line arguments
    public static void main(String args){
    int a=Integer.parseInt(args[0]);
    int b=Integer.parseInt(args[1]);
    System.out.println("Product Of "+a+"*"+b+" ="+ a*b);
    }So you see the difference ? in case 1. you have to recompile the code to find the product of say 8 and 7 whereas in command line argument you just say
    c:\>java findProduct 7 8 // for product of 7 and 8
    c:\>java findProduct 15 8 // for product of 15 and 8 ...
    ie the classs need not be recompiled....
    hope that helps you
    best wishes and regards,
    gaurav

  • Newbie Help: Java Object to create an image

    Hi there.
    I'm trying to create a Java class that I can call from Coldfusion that will build a GIF file based on parameters.
    The idea is, the Java object opens a "background" gif file and then writes some text onto it and saves the whole thing out as a GIF.
    Bearing in mind this class will be used directly by Coldfusion, and so isn't an applet or an application...can anyone tell me what is wrong with this code as I get a null pointer exception on the getGraphics() line:
    // Methods available to Coldfusion
    public String CreateOverlay( String imageFile, String outPath, String overlayText, int x, int y, String fontFace, int PointSize)
    try{
    Toolkit tk = Toolkit.getDefaultToolkit();
    Image im = tk.getImage(imageFile);
    Gif89Encoder enc = new Gif89Encoder();
    OutputStream out = new BufferedOutputStream(
    new FileOutputStream(outPath)
    Image newimg = createImage(100,50);
    ***** Graphics g = newimg.getGraphics();
    g.drawImage(im, 0, 0, 100, 50, this);
    g.drawLine(0,0,50,50);
    enc.addFrame( newimg );
    enc.encode(out);
    out.close();
    catch (Exception e) {
    System.out.println("Error...");
    e.printStackTrace();
    return "Dont care at the moment";
    Any help to this troubled newbie would be appreciated.

    Hi Kurt,
    You must call "setVisible(true)" on your Frame before
    creating the image.But, the thing is, this object doesnt have (or need) a GUI. Its just an object that sits on the server and its methods are called to generate an image on disk. Basically what happens is Coldfusion receives information from a user and it loads the java object, calls a method which then generates a new GIF file that is made up of a simple button background and some text (entered by the user)....it then returns the name of this file to Coldfusion and Coldfusion stores it in a database for later retrieval.
    In simple terms:
    COLDFUSION===========
    1. Creates an instance of the JAVA Object
    2. Call the generateGif method passing an image filename and some text eg:
    newFile=c.GenerateGif( "simplebutton.gif", "Some text for button");
    JAVA OBJECT========= (GenerateGif method)
    1. Load the GIF simplebutton.gif
    2. Create a new blank image
    3. Draw the loaded GIF onto the blank one
    4. Write the Text ("some text for button") onto the image
    5. Take the image and encode it to GIF format
    6. Write this GIF to disk
    7. Return the filename of the new GIF image just created
    8. Finish
    As you can see, I dont want or need a GUI.....
    Is this possible ?
    Thanks in Advance,
    Tony Johnson

  • Newbie to java complete message

    hi everyone,
    I'm a student currently studying IT and now started java. I have been thrown into the deep end and given some java questions to do over the easter period and seem to be struggling. At the moment there is nobody in university to speak to, so thought you guys would be the best solution and was told to use any resources available.
    This is what my lecturer wrote word for word and I don't fully understand what it means? Any help would be greatly appreciated...
    "Complete the methods as indicated by the comments. A test application has been provided (LibraryTest.java)-your output should match that indicated in the comments.
    A book has the following data associated with it; author, title, classmark, whether it is on loan or not and the date it is due to be returned. The classmark has the form LLDD.DD.LDD.LD where L represents a letter and D a digit.
    For example: Author: Bruce Eckel
    Title:THinking in Java
    Classmark: QA76.73.J38.E2
    Due: 28th March 08
    It should not be possible to change the author, title and classmark fields of a book object after it has been created. It should not be possible to renew Book objects, they muct return before being loaned out again.
    *Book.java is the first command:*
    // Book.java
    // A class to represent a single book stored in the library.
    // Each Book is defined by it's author, title and classmark
    /* Create and import appropriate packages */
    /* Appropriate class declaration */ {
    // Define fields with private access
    private String author;
    private String title;
    private String classmark;
    private GregorianCalendar due;
    private boolean onLoan;
    // Creates a new instance of Book
    public Book(String inAuthor, String inTitle, String inClassmark) {
    /* Complete method */
    // Returns true if the book is currently on loan, false otherwise
    public boolean isOnLoan() {
    /* Complete method */
    // Mark the book as being on loan for a specified period (in days)
    public void loan(int numOfDays) {
    /* Set the due field to be numOfDays later than today's date. Check for any
    possible errors in the use of this method. */
    // Mark the book as having been returned
    public void returnBook() {
    /* Complete method */
    /* Appropriate accessors and mutators for author, title, classmark */
    // Access the date the book is due to be returned. Should return an
    // appropriate value if the book is not currently on loan
    public GregorianCalendar getDueDate() {
    /* Complete method */
    // Produce an appropriate string representation of the book object
    public String toString() {
    /* Complete method */
    // An internal method to check whether the classmark is valid
    private static boolean isValidClassmark(String inClassmark) {
    /* Complete method */
    *This is the second part of the program Library.java*
    // Library.java
    // A class to represent and manipulate a set of books.
    /* Create and import appropriate packages */
    /* Appropriate class declaration */ {
    // Use a Vector to store the books
    private Vector books;
    // Creates a new Library instance
    public Library() {
    /* Complete method */
    // Add a book to the library
    public void add( String author, String title, String classmark ) {
    /* Complete method */
    // Produce an appropriate string representation of the book object
    public String toString( ) {
    /* Complete method */
    // Access an element of the list
    public Book getBook(int i) {
    /* Complete method */
    // Determine number of books in the library
    public int size() {
    /* Complete method */
    *This is the LibraryTest.java mentioned in the question:*
    /* import necessary packages */
    public class LibraryTest {
    public static void main(String[] args) {
    Library lib = new Library();
    lib.add("Bruce Eckel", "Thinking in Java", "QA76.73.J38.E2");
    System.out.println(lib);
    lib.add("Bruce Eckel", "Thinking in C#", "QA76.73.J28.E2");
    System.out.println(lib);
    lib.getBook(0).loan(7);
    System.out.println(lib);
    lib.getBook(0).returnBook();
    System.out.println(lib);
    lib.add("Cay Horstmann","Big Java","QA76.73.J38.E2");
    System.out.println(lib);
              System.out.println(lib.size());
              System.out.println(lib.getBook(1));
    /* Should produce output similar to:
    Bruce Eckel, Thinking in Java, QA76.73.J38.E2 [available]
    Bruce Eckel, Thinking in Java, QA76.73.J38.E2 [available]
    Bruce Eckel, Thinking in C#, QA76.73.J28.E2 [available]
    Bruce Eckel, Thinking in Java, QA76.73.J38.E2 [20/4/2008]
    Bruce Eckel, Thinking in C#, QA76.73.J28.E2 [available]
    Bruce Eckel, Thinking in Java, QA76.73.J38.E2 [available]
    Bruce Eckel, Thinking in C#, QA76.73.J28.E2 [available]
    Bruce Eckel, Thinking in Java, QA76.73.J38.E2 [available]
    Bruce Eckel, Thinking in C#, QA76.73.J28.E2 [available]
    Cay Horstmann, Big Java, QA76.73.J38.E2 [available]
    3
    Bruce Eckel, Thinking in C#, QA76.73.J28.E2 [available]
    Thanks
    Chris
    Edited by: chris08 on Mar 31, 2008 10:24 PM

    Complete the methods as indicated by the comments.Do you understand this bit? If not, what part is confusing you?
    A test application has been provided (LibraryTest.java)-your output should match that indicated in the comments.Do you understand this bit? If not, what part is confusing you?
    A book has the following data associated with it; author, title, classmark, whether it is on loan or not and the date it is due to be returned.Do you understand this bit? If not, what part is confusing you?
    The classmark has the form LLDD.DD.LDD.LD where L represents a letter and D a digit.Do you understand this bit? If not, what part is confusing you?
    You have to do some work too. If you don't, guess what? We're not going to do your homework for you.

  • Newbie Question: Java -Xmx and other settings...

    Hi all I have a simple question,
    I know that you can use the -Xms and -Xmx to set the heap size, but when I run this command is it permanent or do I have to set it each time I boot up my Windows system? How do tell what the current heap size is?
    I would be grateful for any help.
    Thanks!

    My dear Friend,
    if you are running your program with
    java -Xmx 1024 -Xms 500 ....
    This values you are using are like jvm arguments and you have to provide them everytime you are running your program.....
    Regards,

  • Newbie Type Java Question

    Hi, I've never used Java before and I'm making a back-end system in PHP/MYSQL and I've come across the issue of printing things. Java being great and good I was wondering if, for example if I create a table with, each with it's element IDs, if I can take those IDs and have Java do a document.writeln whilst rendering data from that HTML table I've just created, or by using PHP variables themselves (I imagine you cannot use PHP variables).
    I'd be outputtung information like this:
    <table>
    <th>Title1</th>
    <th>Title2</th>
    <tr><td><?PHP echo "$Row1Data1"</td><td><?PHP echo "$Row1Data2"</td></tr>
    <tr><td><?PHP echo "$Row2Data1"</td><td><?PHP echo "$Row2Data2"</td></tr>
    </table>
    So I'd be wanting to output that information to a seperate browser window in preparation for printing using java. How do you do it?
    Thanks

    Javascript yes, for use in HTML
    <script language="JavaScript">

  • Newbie: XML/Java - The entity "rsquo" was referenced, but not declared.

    I get the following error when I try to run my java program(it's supposed to read an xml file and print out some of the content).
    How can I fix this problem?
    Thanks,
    [Fatal Error] subject.xml:4:233: The entity "rsquo" was referenced, but not declared.
    org.xml.sax.SAXParseException: The entity "rsquo" was referenced, but not declared.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at DomParserExample2.parseXmlFile(DomParserExample2.java:42)
    at DomParserExample2.runExample(DomParserExample2.java:24)
    at DomParserExample2.main(DomParserExample2.java:115)
    Exception in thread "main" java.lang.NullPointerException
    at DomParserExample2.parseDocument(DomParserExample2.java:54)
    at DomParserExample2.runExample(DomParserExample2.java:27)
    at DomParserExample2.main(DomParserExample2.java:115)

    The easiest way to fix your problem is to not put unreferenced entities into the document. That just makes the document be not well-formed. If somebody else gave you that document, send it back to them and tell them to fix it. If you made it yourself, then you did it wrong. It's hard to say how you did it wrong because you didn't say anything about that.
    If you were hoping for some Java code, there isn't any. If you get an XML document which isn't well-formed, all you can do is to reject it. And that's what happened there. It's the correct thing to do.
    That tutorial you linked to is correct as far as it goes, but in your case you've just got some HTML which somebody carelessly reformatted into XML. You don't want to write an EntityResolver for HTML entities, you either want them to not be there, or for there to be a DTD at the beginning which points to something declaring them.

  • Newbie: standalone java AQ client

    Hello.
    I need to write content from the java program to the Oracle 10g queue.
    I can get acquire the datasource in multiple ways (via DriverManager, Spring's dataSource support classes or from running local OCJ4 via jndi) and than do the following :
    QueueConnectionFactory qc_fact = AQjmsFactory.getQueueConnectionFactory(dataSource);
    QueueConnection qc_conn = qc_fact.createQueueConnection(USER, PASS);
    QueueSession q_session = qc_conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    AQjmsSession jms_sess = AQjmsSession.class.cast(q_session);
    Queue queue = jms_sess.getQueue(Q_USER, Q_NAME);
    AQjmsProducer q_sender = (AQjmsProducer) jms_sess.createProducer(queue);
    TextMessage msg = jms_sess.createTextMessage("Hello queue!");
    q_sender.send(msg, DeliveryMode.PERSISTENT, 1, 600000);Also i''ve enable tracing with AQjmsOracleDebug class.
    The output is always the same (this was when using oci4j jndi datatsource lookup):
    main [Thu Jun 26 18:19:33 MSD 2008] AQjmsQueueConnectionFactory - constructor:  data source object: oracle.oc4j.sql.ManagedDataSource@16e1fb1
    main [Thu Jun 26 18:19:33 MSD 2008] AQjmsQueueConnectionFactory.createQueueConnection:  with user/pwd
    main [Thu Jun 26 18:19:33 MSD 2008] AQjmsDBConnMgr ctor (datasource):  enter
    main [Thu Jun 26 18:19:33 MSD 2008] AQjmsDBConnMgr.getConnection:  Creating from datasource
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsDBConnMgr.extraInit:  enter
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsDBConnMgr.extraInit:  The connection class: oracle_jdbc_driver_LogicalConnection_Proxy
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsDBConnMgr.extraInit:  exit
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsDBConnMgr.getConnection:  generic->DB connection: oracle_jdbc_driver_LogicalConnection_Proxy@12cd19d
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsDBConnMgr.getConnection:  generic->XA connection: null
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsDBConnMgr ctor (datasource):  exit
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsConnectionn ctor (datasource):   type: 10
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsConnection.setCompliant:  Current <compliant> is set to:false
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsQueueConnectionFactory.createQueueConnection w/username/password:  Connection created successfully
    main [Thu Jun 26 18:19:44 MSD 2008] AQjmsDBConnMgr.getConnection:  get the firstConn created during the authentication
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.constructor:  dbversion=10204
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.setDBRatio:  enter
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.setRatio:  The DB csid = 171
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.setRatio:  exit
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.constructor:  enter
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.constructor:  looking up the transaction manager object in OC4J.
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.constructor: Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at oracle.jms.EmulatedXAHandler.<init>(EmulatedXAHandler.java:69)
         at oracle.jms.AQjmsSession.<init>(AQjmsSession.java:364)
         at oracle.jms.AQjmsConnection.createQueueSession(AQjmsConnection.java:653)
         at QueueClient.main(QueueClient.java:86)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
         at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
         at org.apache.tools.ant.taskdefs.Java.run(Java.java:747)
         at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:201)
         at org.apache.tools.ant.taskdefs.Java.execute(Java.java:104)
         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
         at org.apache.tools.ant.Task.perform(Task.java:348)
         at org.apache.tools.ant.Target.execute(Target.java:357)
         at org.apache.tools.ant.Target.performTasks(Target.java:385)
         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
         at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
         at org.apache.tools.ant.Main.runBuild(Main.java:698)
         at org.apache.tools.ant.Main.startAnt(Main.java:199)
         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.constructor:  Can not find the transaction manager, we are NOT running in OC4J container
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.constructor:  exit
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.inGlobalTrans:  entry
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.inGlobalTrans:  oracle.jms.useEmulatedXA is on
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.inGlobalTrans:  entry, reCheck=true
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.checkForGlobalTxn:  entry
    main [Thu Jun 26 18:19:45 MSD 2008] EmulatedXAHandler.inGlobalTrans:  exit
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.inGlobalTrans:  exit
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.constructor1:  oci enabled = true
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsConnection:createQueueSession:  Created session
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.getQueue IN:   owner: INVITO, name: RAW_Q2
    main [Thu Jun 26 18:19:45 MSD 2008] AQjmsSession.getQueue:  created AQOracleSession
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsSession.getQueue:  finish AQOracleSession.getQueue()
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsSession.getQueue EXIT: 
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsSession.getCompliant:  Session <compliant>:false
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsSession.createTextMessage:  return initialized text message
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsSession.getCompliant:  Session <compliant>:false
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsProducer.send-2:  entry
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsProducer.send-main:  entry
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsProducer.send:  queue: INVITO.RAW_Q2
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsProducer.send:  dest_queue: INVITO.RAW_Q2
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsProducer.enqueue:  entry
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsSession.getCompliant:  Session <compliant>:false
    main  setJMSTimestamp. timestamp: 1214489986386
    main [Thu Jun 26 18:19:46 MSD 2008] AQjmsProducer.enqueue:  exitIt seems that if i want to enque messages to the queue the code MUST run in OC4J environment, isn't it?
    Is there any way to enqueue a message from the simple standlone java app?

    Here is some sample code that may assist you:
    How To Enqueue and Dequeue a Message in Oracle 10g
         Doc ID:      Note:357250.1      Type:      HOWTO
         Last Revision Date:      20-NOV-2007      Status:      PUBLISHED
    Checked for relevance on 20-11-2007
    In this Document
    Purpose
    Software Requirements/Prerequisites
    Configuring the Sample Code
    Running the Sample Code
    Caution
    Sample Code
    Sample Code Output
    Applies to:
    Oracle Server - Enterprise Edition - Version: 9.2.0.4.0
    Information in this document applies to any platform.
    DATABASE 9.2.0.7
    JDEVELOPER 10.1.2.1
    Purpose
    The sample code will enqueue and dequeue a message.
    Software Requirements/Prerequisites
    SQLPLUS that comes with Oracle Database 9.2.0.7
    JDeveloper 10.1.2.1
    JDBC Driver that comes with Oracle 10.1.2.1 (10.1.0.4.2)
    JDK 1.4.2.06
    AQ Api that comes with JDeveloper 10.1.2.1 (jta.jar , aqapi13.jar , jms.jar)
    Configuring the Sample Code
    You need to use Sqlplus to create the queue table, queue and start the queue.
    You need Jdeveloper to create the JMS client that will enqueue and dequeue the message.
    Steps will follow
    Running the Sample Code
    I- In sqlplus:
    1. Run the following to grant privileges to user:
    connect sys/welcome@orcl92 as sysdba
    grant aq_administrator_role to scott;
    grant execute on dbms_aqadm to scott;
    grant execute on dbms_aq to scott;
    grant execute on dbms_aqin to scott;
    grant execute on dbms_aqjms to scott;
    connect scott/tiger
    2. Create the Queue Table and the Queue:
    BEGIN
    sys.dbms_aqadm.create_queue_table (
    queue_table => 'POA_QUEUE_TABLE'
    , queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE'
    , sort_list => 'ENQ_TIME'
    , comment => ''
    , multiple_consumers => TRUE
    , message_grouping => DBMS_AQADM.NONE
    , compatible => '8.1'
    , primary_instance => '0'
    , secondary_instance => '0');
    COMMIT;
    END;
    BEGIN
    sys.dbms_aqadm.create_queue(
    queue_name => 'POA_QUEUE'
    , queue_table => 'POA_QUEUE_TABLE'
    , queue_type => sys.dbms_aqadm.NORMAL_QUEUE
    , max_retries => '5'
    , retry_delay => '0'
    , retention_time => '0'
    , comment => '');
    END;
    BEGIN
    sys.dbms_aqadm.start_queue(
    queue_name => 'POA_QUEUE'
    , enqueue => TRUE
    , dequeue => TRUE);
    END;
    begin DBMS_AQADM.ADD_SUBSCRIBER
    ('POA_QUEUE'
    , SYS.AQ$_AGENT('POA_SUBSCRIPTION'
    , NULL
    , NULL));
    end;
    Caution
    This script is provided for educational purposes only and not supported by Oracle Support Services. It has been tested internally, however, and works as documented. We do not guarantee that it will work for you, so be sure to test it in your environment before relying on it.
    Proofread this sample code before using it! Due to the differences in the way text editors, e-mail packages and operating systems handle text formatting (spaces, tabs and carriage returns), this sample code may not be in an executable state when you first receive it. Check over the sample code to ensure that errors of this type are corrected.
    Sample Code
    II- In JDeveloper 10.1.2.1
    1. Create a workspace with a project.
    2. Create DBSession.java which will have the following code:
    package mypackage1;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import javax.jms.JMSException;
    import javax.jms.TextMessage;
    import javax.jms.Topic;
    import javax.jms.TopicConnection;
    import javax.jms.TopicPublisher;
    import javax.jms.TopicSession;
    import javax.jms.TopicSubscriber;
    import oracle.AQ.AQDequeueOption;
    import oracle.AQ.AQDriverManager;
    import oracle.AQ.AQEnqueueOption;
    import oracle.AQ.AQException;
    import oracle.AQ.AQMessage;
    import oracle.AQ.AQObjectPayload;
    import oracle.AQ.AQOracleQueue;
    import oracle.AQ.AQOracleSession;
    import oracle.AQ.AQQueue;
    import oracle.AQ.AQRawPayload;
    import oracle.AQ.AQSession;
    import oracle.jms.AQjmsSession;
    import oracle.jms.AQjmsTopicConnectionFactory;
    public class DBSession {
    public static Connection db_conn;
    public static AQSession createSession(String args[]) {
    AQSession aq_sess = null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // replace with specific host:port:databasename
    db_conn = DriverManager.getConnection("jdbc:oracle:thin:@dbhost:1521:orcl92","scott","tiger");
    System.out.println("JDBC Connection opened ");
    db_conn.setAutoCommit(false);
    Class.forName("oracle.AQ.AQOracleDriver");
    // Create AQ Session.
    aq_sess = AQDriverManager.createAQSession(db_conn);
    System.out.println("Successfully created AQSession ");
    } catch (Exception ex) {
    System.out.println("Exception: " + ex);
    ex.printStackTrace();
    return aq_sess;
    public static void AQObjectPayloadTest(AQSession aq_sess)
    throws AQException, SQLException, ClassNotFoundException, JMSException
    //Used for standard AQ
    AQQueue queue = null;
    AQMessage message = null;
    AQRawPayload payload = null;
    AQEnqueueOption eq_option = null;
    AQDequeueOption dq_option = null;
    //Used for subscription and topic based queues.
    Topic inqueueTopic, outqueueTopic;
    TopicConnection topicConnection;
    TopicSession session;
    TextMessage out = null;
    TopicSubscriber subscriber;
    TextMessage textMessage;
    TopicPublisher publisher;
    // Configure for specific host, Database, port, etc..
    String hostname = "DBhostname";
    String database = "orcl92";
    String user = "scott";
    String password = "tiger";
    String schema = "scott";
    String inqueue = "POA_QUEUE";
    String outqueue = "POA_QUEUE";
    String subscription = "POA_SUBSCRIPTION";
    String port = "1521";
    // JMS Dequeue implementation.
    // Create a topic session and connection..
    topicConnection = AQjmsTopicConnectionFactory.createTopicConnection(db_conn);
    session = topicConnection.createTopicSession(true, 0);
    topicConnection.start();
    inqueueTopic = ((AQjmsSession)session).getTopic(schema, inqueue);
    outqueueTopic = ((AQjmsSession)session).getTopic(schema, outqueue);
    // Enqueue a test message
    textMessage = session.createTextMessage();
    textMessage.setJMSCorrelationID("POA_QUEUE");
    textMessage.setText("Test Message!!!");
    publisher = session.createPublisher(outqueueTopic);
    publisher.publish(textMessage);
    publisher.close();
    session.commit();
    // Dequeue the same message
    inqueueTopic = ((AQjmsSession)session).getTopic(schema, inqueue);
    outqueueTopic = ((AQjmsSession)session).getTopic(schema, outqueue);
    subscriber = session.createDurableSubscriber(inqueueTopic,subscription);
    out = (TextMessage)subscriber.receive(0);
    System.out.println("Message retrieved: " + out.getText());
    db_conn.commit();
    You need to modify the hostname, port, sid according to your environment.
    3. Create AQTest.java:
    package mypackage1;
    import java.sql.SQLException;
    import javax.jms.JMSException;
    import oracle.AQ.AQException;
    import oracle.AQ.AQSession;
    public class AQTest {
    public static void main(String[] args)
    AQTest test = new AQTest();
    test.start();
    private void start() {
    //create session
    AQSession session = DBSession.createSession(null);
    //create queue
    try {
    DBSession.AQObjectPayloadTest(session);
    } catch (AQException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    catch (JMSException jmse) {
    jmse.printStackTrace(); }
    4. Compile and run AQTest.java. You will get the following output:
    Sample Code Output
    JDBC Connection opened
    Successfully created AQSession
    Message retrieved: Test Message!!!
    Process exited with exit code 0.

  • Newbie to  Java & J2sdk1.4.2

    I downloaded and installed the program, wrote the the test code in note pad and then went to commaned prompt, found the file and tried to run it, instead of it saying HelloWorld it sends me back to note pad where I wrote the code, what I'm I doing wrong???
    TIA
    Dash65

    Hi there.
    1. After you write a code using notepad, save your file as HellWorld.java
    Be aware of "HelloWorld.java.txt" from notepad.
    2. Go to your command prompt, locate your file, and compile it first:
    javac HelloWorld.java
    3. After succesufull compiled, you will see HelloWorld.class in the same directory. Now, try to run your code:
    java HelloWorld
    You'll see HelloWorld prints out on your command prompt.
    Hope this help
    -T-

  • Newbie to java, need a program to write

    ok, i havent done anything in applets yet, but i was able to do linkedlists in java console. what would be a good begining program to try out to somewhat test my skills?

    ok, i havent done anything in applets yet, but i was
    able to do linkedlists in java console. what would be
    a good begining program to try out to somewhat test my
    skills?I'll suggest a program I always wanted to write, but never did (I guess I've been too bussy, or too lazy...)
    The program consist of a resistor calculator. Given a resistance (in OHM), and the quantity of resistors, and the combination way (series or parallel), the app will tell you the comercial values of the closest combination. Maybe it can also throw a little figure with the color codes.

  • Newbie to Java ME

    Hey folks, just getting into Java ME. I've coded in the past, but this Java ME is new to me.
    I've got the Java ME SDK 3.0 installed just fine. It's working and everything. My question is how do I change the simulated device to the exact device I want to develop for? It's got a pretty generic one that comes up now. I want to dev for the RIM BlackBerry 8310. I know how to change the properties of the project, but right now, there's only 4 or 5 diff types of devices I can pick from. Any info is appreciated. Thanks!

    Hi,
    Blackberry has a different development environment. J2ME applications have a .jad and .jar files that are to be installed on the mobile devices, but Blackberry devices support .cod files and not .jar and .jad files. So you have to make a .cod file first and then deploy that file on the mobile device either thru bluetooth or data cable.
    One more thing since you have developed application using j2me it means you have a .jad and .jar files then you can try to convert this files into .cod files. Search for converting .jad and .jar files into .cod. This should be it I suppose for your problem.
    Sunil
    Software Developer - J2ME

  • Newbie to Java Doc

    Hello All,
    I am pretty new to JavaDoc - i got a general hang of it and did some sample java doc generations for some java files to understand more better. Now I have been requested to create custom javadoc tags for an existing project. How do I go about this? It would be appreciated if anyone could help me out with pointers .
    Thanks

    Depending on how complex the produced output of your custom tags should be you can either use Javadoc's -tag option or write a custom Taglet.
    See [http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#tag] and [http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/taglet/overview.html] for related documentation.

  • Newbie to java programming

    Hi
    I'm completely new to Java programming, I have worked for a year in Qbasic, but that is like kids play kind of programming, im unsure as to the similarities/differences between the 2 languages.
    Also: I know that Java is an "Object oriented" form of programming, can anyone explain what this means?
    Im going to start at the beginning of the manual, is it ok if i come here and ask questions if im stuck with anything? I don't know what the community is like here...
    Thanks,
    Chloe

    Here are some good introductions to OOP:
    Object-Oriented Programming Concepts
    Object-oriented language basics
    Don't Fear the OOP
    And here are some other great resources for beginning Javites:
    http://java.sun.com/docs/books/tutorial/
    http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/compile.html
    http://java.sun.com/learning/new2java/index.html
    http://javaalmanac.com
    http://www.jguru.com
    http://www.javaranch.com
    Bruce Eckel's Thinking in Java
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java
    Good luck, and Happy Coding!
    &#167;

  • NEwbie at JAva Web Services

    Hi guys,
    I am extremely new to Web services using Java. I would say I am reasonable competent with java language.
    I would liek to learn how to do a interesting website for myself which employs web technologies and real time dynamic interaction with users of my website. I do have experience in doing simple static webpages and I am running my own webserver (Apache HTTP Server).
    I would like to implement some mroe advanced web services on my webpage using Java ( since I laready know Java).
    I do not know where to start. Do I start with JAva Servlets ? JSPs ? UDDI ? COM ? XML ???
    Please kindly advise.
    Regards
    David

    I think Java servlets is enough for a personal site.

Maybe you are looking for

  • Packaging for Performance

    The section "About Application Classloaders" of the documentation for WebLogic Server 6.1 has the following: When WebLogic Server deploys an application, it creates two new classloaders: one for EJBs and one for Web applications. The EJB classloader

  • Flash player not working in IO7 page download

    I just downloaded (Save as - complete) a IE7 (Internet Explorer 7.) web page to my harddrive, when I open it indicates by the Icon present in the upper corner of the opened web page that I need to download Flash Player. The webpage is basically an ec

  • Non-Flash based internet speed test sites for touch?

    I'd like to test my internet speed directly from my touch. It seems like the speed test sites out there that I've found (like www.speakeasy.net/speedtest)use Flash which won't work with the touch. Does anyone know of any internet speed test sites tha

  • How to add an Event action filter when victim address is " na "?

    Using VMS/IPS MC to add an event action filter. IPS MC requires an victim address in the event action filter, however the alert in Security Monitor has "<na>" as the victim address. I tried "0.0.0.0 255.255.255.255", which caught the alerts that had

  • Configure WPA2 on a 1041

    Hello Everyone, Can someone send me a link or steps to configure WPA2 on a 1041 access point?  I am trying to get it configured through the GUI and part way through I keep getting locked out of the AP due to WPA2 being partially configured..  Can;t f