New programmer - Old Java code

I am new to Java (but old to Delphi) and have inherited an application in Java from six years ago. What development environment should I start learning?
Thanks...... Jim

How quickly do you think you can pick Java up? I generally recommend learning without an IDE. Esp if you currently know no Java.
As to the general case to "Which IDE should I use", the only answer to this is: Try as many as you can, and use the one you feel most at home with. Out of the main free two: Netbeans has the better drag+drop GUI support and the most stuff pre-configured and good to go out the box (IMO), but Eclipse has the nicer text editor and better 3rd party support.
Stock learning Java Answer:
[Sun's basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
[Sun's New To Java Center|http://java.sun.com/learning/new2java/index.html]
Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
jGuru
A general Java resource site. Includes FAQs, forums, courses, more.
JavaRanch
To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
[Yawmarks List|http://forums.devshed.com/java-help-9/resources-for-learning-java-249225.html]
[The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance]
[http://javaalmanac.com|http://javaalmanac.com]
Bruce Eckel's [Thinking in Java(Available online.)|http://mindview.net/Books/DownloadSites]
Joshua Bloch's [Effective Java|http://www.amazon.co.uk/exec/obidos/Author=Bloch,%20Josh]
Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance ]
James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806]
Gosling is the creator of Java. It doesn't get much more authoritative than this.
Joshua Bloch and Neal Gafter [Java Puzzlers.|http://www.javapuzzlers.com/]

Similar Messages

  • How to insert a new attachment via java code

    Hi everybody,
    I need add a new attachment via java code. I found the service EDIT_RENDITIONS on the Add Attachments page. But this service is not documented. Does somebody have a example how to add attachments?
    Thank you
    Martin

    Martin,
    Try the following code:
    final IdcClientManager clientManager = new IdcClientManager();
    IdcClient client;
    try {
        client = clientManager.createClient(IDC_PROTOCOL + RIDC_SERVER + ":" + RIDC_PORT);
        final String username = "sysadmin";
        final DataBinder dataBinderReq = client.createBinder();
        ServiceResponse severiceResponse = null;
        dataBinderReq.putLocal("IdcService", "EDIT_RENDITIONS");
        dataBinderReq.putLocal("dID", "1560"); // as integer
        dataBinderReq.putLocal("dDocName", "DEV2_001509"); // as string
        dataBinderReq.putLocal("renditionKeys", "addRendition0"); // as string
        dataBinderReq.putLocal("addRendition0.name", "theFileName");
        dataBinderReq.putLocal("addRendition0.description", "theFileDescription");
        dataBinderReq.putLocal("addRendition0.action", "edit");
        final String fileName = "c:\\test.txt";
        final File file = new File(fileName);
        final TransferFile tf = new TransferFile(file);
        dataBinderReq.addFile("addRendition0.file", tf); // as byte
        severiceResponse = client.sendRequest(new IdcContext(username), dataBinderReq);
        final DataBinder dataBinderResp = severiceResponse.getResponseAsBinder();
        //  DataBinder resultado = severiceResponse.getResponseAsBinder();
        System.out.println(dataBinderResp.toString());
    } catch (final IdcClientException e) {
        System.out.println(e.getMessage());
        e.printStackTrace(System.out);
    Jonathan
    http://jonathanhult.com

  • Create a new File from java code

    Hi,
    I'd like to create a new File on IFS, using Java code. Moreover, this file will be an image file, and I'd like to store meta data with this file... and then execute a search on this meta data.
    I know it must not be very difficult to do, but I can't find any code sample.
    Does anyone could give me some usefull link or advice ?
    thanks in advance,
    Roger.

    First of all, you need to create your custom class. You can do it using iFS Manager, extending the class DOCUMENT. Let's call this class IMAGE with the attributes "length", "width", "colorDepth". Take a look at the code that creates one instance:
    You need one instance of LibrarySession (that appears in the code named "ifsSession").
    You need also the InputStream of the image you want to store (that appears in the code named "contentStream").
    // Setting the attributes
    DocumentDefinition def = new DocumentDefinition(ifsSession);
    def.setClassname("IMAGE");
    def.setAttribute("NAME", AttributeValue.newAttributeValue("nameOfTheImage"));
    def.setAttribute("LENGTH", AttributeValue.newAttributeValue(100));
    def.setAttribute("WIDTH", AttributeValue.newAttributeValue(230));
    def.setAttribute("COLORDEPTH", AttributeValue.newAttributeValue(1024));
    def.setContentStream(contentStream);
    // Creation
    Document doc = (Document) ifsSession.createPublicObject(def);
    I hope this helps,
    Fabio Nunes

  • New problem  --  My java code can't see my CLASSES from Mapping Workbench

    Donald and others -
    I am VERY new to TopLink......
    I was at the last Oracle Developer Days in Northern Virginia. Donald convinced me and my co-workers to use TopLink for our upcoming project. I have been having tons of problems getting it to work correctly. Maybe I need a TOPLINK license plate, like Donald!!!
    Here is my newest problem. I can create a DatabaseSession, login to it, write a query and log out of it.
    However, I can only do this if I remove my classes from the Mapping Workbench. As soon as I add even one class to the Mapping Workbench......I get an error as follows:
    LOCAL EXCEPTION STACK:
    EXCEPTION [TOPLINK-3007] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.ConversionException
    EXCEPTION DESCRIPTION: The object [mil.usa.lbit.isr.TestIsr], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager
    INTERNAL EXCEPTION: java.lang.ClassNotFoundException: mil.usa.lbit.isr.TestIsr
    Can anyone tell me where I need to put my class files so the java code can see them via the ISR.xml deployment file.
    I currently have these files in a .jar file on the system path and in my web-inf folder and in my project settings. I put them everywhere I could think of, but no luck.
    Here is my code:
    package mil.usa.lbit.isr;
    import mil.usa.lbit.LbitColors;
    import java.util.*;
    import java.math.*;
    import oracle.toplink.sessions.*;
    import oracle.toplink.tools.schemaframework.*;
    import oracle.toplink.exceptions.*;
    import oracle.toplink.expressions.*;
    import oracle.toplink.queryframework.*;
    import oracle.toplink.tools.workbench.*;
    public class TestIsr extends ISR {
    public DatabaseSession session;
         public Project project;
    public TestIsr() {
    this.name = "TestISR";
    this.color = LbitColors.AMBER;
    this.metric = 97.00;
    public boolean isConnected() {
    if (session == null)
    System.out.println("Not Connected");
    return false;     
    System.out.println("Connected");
    return session.isConnected();
    public void loginToDatabase() {
    Project builderProject;
    System.out.println("Attempt to login to database using TopLink:");
    project = XMLProjectReader.read("C:\\LBIT TopLink\\ISR\\ISR.xml");
    session = project.createDatabaseSession();
    session.login();
    System.out.println("Logged in");
    public void runQuery() {
    ExpressionBuilder builder = new ExpressionBuilder();
    Expression expression = builder.get("isr_id").equal(3);
    System.out.println(expression);          
    //TestIsr isr = (TestIsr) session.readObject(TestIsr.class, expression);
    //System.out.println(isr);     
    public void logoutOfDatabase() {
    session.logout();     
    System.out.println("Logged out");          
    public static void main(String[] args) {     
    TestIsr testing = new TestIsr();
    testing.isConnected();     
    testing.loginToDatabase();          
    testing.isConnected();
    testing.runQuery();
    testing.logoutOfDatabase();     
    Thanks in advance.
    Donald please email me and maybe we can chat on the phone if you want to offer some help.
    Andy

    Thanks for the reply!
    However, I did try to implement that yesterday.
    When I add the "getClass().getClassLoader()" to the "XMLProjectReader.read" call, the codes loses site of my project (.xml) file.
    Here is the new line:
    project = XMLProjectReader.read("C:\\LBIT TopLink\\ISR\\ISR.xml", getClass().getClassLoader());
    Here is the new error:
    EXCEPTION [TOPLINK-7099] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.ValidationException
    EXCEPTION DESCRIPTION: Could not find xml project file which is specified in properties file: xmlProjectFile=C:\LBIT TopLink\ISR\ISR.xml.
         oracle.toplink.exceptions.ValidationException oracle.toplink.exceptions.ValidationException.projectXMLNotFound(java.lang.String, java.lang.Exception)
         oracle.toplink.sessions.Project oracle.toplink.tools.workbench.XMLProjectReader.read(java.lang.String, java.lang.ClassLoader)
    But my code could find that file before I added the "getClass().getClassLoader()" code.
    Maybe I can avoid this problem by "deploying the XML file in my application jar?" Could you please explain more about this option after answering the first part of my question.
    Any other posters feel free to help me too.
    I know TopLink is a powerful tool, I just keep hitting these hurdles. ARRRRRRRGGGG!!!
    Thanks again,
    Andy

  • Open new window using java code and not in script

    i need some method like sendredirect or forward . where i can make some codes so as to open a new window.
    actually i am calling a jsp from one jsp file where a lot of dynamic parameters are sent. and in the second jsp i call a servlet which works to download a file to the client side. i want the file should open in new window not in the browser from where it is initiated.
    else can any one say the mime type where i can open file(a xls file) in xls window and not in browser which is not needed as user needs to press the back button(present in browser)

    Hi,
    in your code
    the following code, which is used to set the file name that is to be downloded
    response.setHeader("Content-Disposition", "*inline*; filename=somename.xls" );
    to be replaced by
    response.setHeader("Content-Disposition", "*attachment*; filename=somename.xls" );
    it will work fine try it.
    Edited by: Bhaskar.krishna on Jan 17, 2008 12:56 AM

  • Set classpath from java code

    Hi,
    Is it possible to set new classpath from java code? Something like System.setClasspath(String);
    Many thanks
    Miso

    You aren't the first one to wonder whether that would work, so don't call yourself stupid on that account.
    Not taking 15 minutes to set up and run a test to actually see if it works... well, if you really needed the answer, that would be different.

  • Trying to load illustrator 6cs onto new mac and the old activation code for my ill cs doesn't work with it

    Trying to load a downloaded version of illustrator 6cs onto new mac and the old activation code for my illustrator cs doesn't work with it.  Do I need a new code or am I missing something?  Same goes for my Photoshop cs.

    you need your serial number.
    if you purchased from or registered with adobe check your account, https://www.adobe.com/account.html

  • Java code to create a new .txt file in FTP server  --- Help

    Hi,
    I wrote a standalone java app which creates a .txt file in my local machine and transfers it to FTP server. But my requirement now is to create a new .txt file with the same content in FTP server itself instead of creating locally with basic java code.
    I'm aware of transfering file from local machine to the FTP server using STOR command of FTP. But i never tried creating a new file & writing content into that in FTP server.
    So, if any one did this before please help me out with source code or any idea ???
    Thank you.
    Vj.

    simply_vijay wrote:
    thanks for your reply. yes i've seen the Apache Commons NET API , but there is no method or class to create a new file in FTP server. I'm really worried how to solve this problem ???Sure there is.
    There's a method where you can write data to a file on the server using an OutputStream, right? Well, instead of writing to a FileOutputStream, write to that OutputStream instead. Remember to close the OutputStream and call the method which says you're finished with the command (I forget what it's called).

  • Mapping new product code from source system to old product code in Oracle COA

    Mapping new product code from source system to old product code in Oracle COA
    Here is the situation:
    One of our legal entities is changing their product codes in their COA segment. We are not changing the code structure in the global SOB. Is there a workaround to pull the source system information into ADI (or any other tool) and map it to the current Oracle product code?
    Thanks and regards,
    [email protected]

    Only The  Data of Your Code will Change
    then if you are trying to copy a standarad sap-code , you need to copy
    every include, FM
    there is a Copy option over there in program
    you can do tat
    thnkx bhanu

  • Old school code :-(

    Hey,
    I been writing my game and wanted to show somone my game. However i can only get the newer java vm to work on his computer. Well i been writing my code for an older version becuase JBuilder wouldnt configure properly.
    Well, the game works but the buttons dont work and i get a white background instead of black in the newer java vm. but everything works in the old one.
    Well i want to update my code to the newest java VM.
    The one i been using is:
    java version "1.2"
    Classic VM (build JDK-1.2-V, native threads)
    ok, i post my code and i be most thankfulif you can show me where i need to modify the code. There are images in the program which i feel are not needed, so if you wanna compile it and run it, just use random images or block the code that does it so it can be tested
    OK, thanks in advance, sorry for the length of the program but i kinda kept it tidy and readable.
    ALso sorry its not documented :-(
    ====spacy.java=================
    //Title:      Space Shooter
    //Version:   
    //Copyright:  Copyright (c) 2004
    //Author:     Tom Lorentsen
    //Company:    MATX Software
    //Description:Space shooter game
    package spacy;
    import javax.swing.UIManager;
    import java.awt.*;
    public class spacy {
      boolean packFrame = false;
      //Construct the application
      public spacy() {
        game frame = new game();
        //Validate frames that have preset sizes
        //Pack frames that have useful preferred size info, e.g. from their layout
        if (packFrame)
          frame.pack();
        else
          frame.validate();
        //Center the window
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height)
          frameSize.height = screenSize.height;
        if (frameSize.width > screenSize.width)
          frameSize.width = screenSize.width;
        frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        frame.setBackground(Color.black);
        frame.setVisible(true);
      //Main method
      public static void main(String[] args) {
        //try  {
          //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        //catch(Exception e) {
        new spacy();
    ====game.java==================
    //Title:      Space Shooter
    //Version:
    //Copyright:  Copyright (c) 2004
    //Author:     Tom Lorentsen
    //Company:    MATX Software
    //Description:Space shooter game
    package spacy;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.GraphicsDevice;
    import java.util.Random;
    import java.applet.*;
    import java.io.*;
    import java.net.URL;
    public class game extends JFrame {
      BorderLayout borderLayout1 = new BorderLayout();
      CardLayout cc = new CardLayout();
      int gamespeed = 20;
      boolean ismenu = true;
      boolean isgame = false;
      int menuspace = -10;
      int menuchoice = 0;
      MediaTracker track = new MediaTracker(this);
      Image[] title = new Image[1];
      Image[] spaceships = new Image[10];
      Image[] planets = new Image[10];
      int[][] spaceshipsize = new int[10][2];
      boolean[] keys = new boolean[256];
      int[] playerpos = {10, 200};
      int weapon = 0;
      String[] weaponname = {"Laser","Dual Laser","Chain Gun","Flak","Homer","Blaster","Rail Gun","Bomb","9","10"};
      int[] weaponpower = { 1,1,1,4,4,4,15,15,1,1};
      int[] weaponammo = {0,0,100,100,100,100,100,100,100,100};
      int[] shield = {50,100,1};
      int[] chaingunpos = {0,0};
      int[][] playerlasers = new int[100][6];
      long bullettime = System.currentTimeMillis();
      int[][] ship = new int[100][5];
      long[] shiplasertimer = new long[100];
      int[] packet = {0,0,0};
      Random r = new Random();
      int maxship = 1;
      long score = 0;
      int level = 0;
      long nextscore = 1000;
      long multiplyertime = 0;
      int multiplyer = 1;
      boolean multiplyerok = false;
      boolean sleepy = false;
      int[][] shipspecs = {//Hits, Speed, Points, laser, timer
                          {  1   , 1    , 1     , 0        },
                          {  2   , 3    , 100   , 0         },
                          {  4   , 6    , 200   , 0         },
                          {  6   , 2    , 300   , 0         },
      int spacepos = 0;
      int[][] planetpos = {{100,200,0},{600,300,1},{1000,150,2},{1500,200,0}};
      Graphics bufferGraphics;
      Image offscreen;
      Dimension dim;
      Font bigtext = new Font("Tahoma",Font.BOLD,20);
      Font smalltext = new Font("Tahoma",Font.BOLD,12);
      //Construct the frame
      public game() {
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        try  {
          jbInit();
        catch(Exception e) {
          e.printStackTrace();
      //Component initialization
      private void jbInit() throws Exception  {
        this.getContentPane().setLayout(borderLayout1);
        this.getContentPane().setBackground(Color.black);
        this.setSize(new Dimension(600, 500));
        this.setTitle(".:Space Shooter:.");
        addKeyListener(new java.awt.event.KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            this_keyPressed(e);
          public void keyReleased(KeyEvent e) {
            this_keyReleased(e);
        new Thread(new display()).start();
        new Thread(new animatemenu()).start();
        new Thread(new menuchoiceselection()).start();
        Toolkit kit = Toolkit.getDefaultToolkit();
        spaceships[0] = kit.getImage("littleship.gif");
        //URL imageResource = getClass().getResource("/littleship.gif");
          //spaceships[0] = kit.getImage(imageResource);
        track.addImage(spaceships[0],0);
        spaceships[1] = kit.getImage("littleship1.gif");
        //imageResource = getClass().getResource("/littleship1.gif");
          //spaceships[1] = kit.getImage(imageResource);
        track.addImage(spaceships[1],1);
        spaceships[2] = kit.getImage("littleship2.gif");
        //imageResource = getClass().getResource("/littleship2.gif");
          //spaceships[2] = kit.getImage(imageResource);
        track.addImage(spaceships[2],2);
        spaceships[3] = kit.getImage("littleship3.gif");
        //imageResource = getClass().getResource("/littleship3.gif");
          //spaceships[3] = kit.getImage(imageResource);
        track.addImage(spaceships[3],3);
        planets[0] = kit.getImage("planet1.jpg");
        //imageResource = getClass().getResource("/planet1.gif");
          //spaceships[4] = kit.getImage(imageResource);
        track.addImage(planets[0],4);
        planets[1] = kit.getImage("planet2.jpg");
        //imageResource = getClass().getResource("/planet2.gif");
          //spaceships[5] = kit.getImage(imageResource);
        track.addImage(planets[1],5);
        planets[2] = kit.getImage("planet3.jpg");
        //imageResource = getClass().getResource("/planet2.gif");
          //spaceships[5] = kit.getImage(imageResource);
        track.addImage(planets[2],6);
        title[0] = kit.getImage("spaceshooter.gif");
        track.addImage(title[0],7);
        System.out.println("Loading map images");
        try {
          track.waitForAll();
        } catch (InterruptedException e){}
        System.out.println("Loaded map images");
        spaceshipsize[0][0] = 20;
        spaceshipsize[0][1] = 20;
        spaceshipsize[1][0] = 15;
        spaceshipsize[1][1] = 15;
        spaceshipsize[2][0] = 15;
        spaceshipsize[2][1] = 20;
        spaceshipsize[3][0] = 25;
        spaceshipsize[3][1] = 32;
        //this.getContentPane().add(jPanel1, BorderLayout.CENTER);
        this.getContentPane().setLayout(cc);
        jPanel1.setBackground(Color.black);
        jPanel2.setBackground(Color.black);
        this.getContentPane().add(jPanel1, "jPanel1");
        this.getContentPane().add(jPanel2, "jPanel2");
        cc.show(this.getContentPane(),"jPanel1");
      //Overridden so we can exit on System Close
      protected void processWindowEvent(WindowEvent e) {
        super.processWindowEvent(e);
        if(e.getID() == WindowEvent.WINDOW_CLOSING) {
          System.exit(0);
      JPanel jPanel1 = new JPanel() {
        public void paintComponent(Graphics g) {
          Graphics2D c = (Graphics2D)g;
          c.clearRect(0,0,jPanel1.getWidth(),jPanel1.getHeight());
          c.setColor(Color.blue);
          c.fillRoundRect((jPanel1.getWidth()/2)-50,186 + (menuchoice*20),100,20,5,5);
          c.setColor(Color.black);
          //c.drawLine(menuspace,100,menuspace+10,105);
          //c.drawLine(menuspace,110,menuspace+10,105);
          c.drawImage(spaceships[0],menuspace,105,this);
          c.setColor(Color.white);
          c.drawImage(title[0],(jPanel1.getWidth() - 482)/2,20,this);
          c.drawString("START",(jPanel1.getWidth()/2)-20,200);
          c.drawString("CONTINUE",(jPanel1.getWidth()/2)-32,220);
          c.drawString("HIGH SCORES",(jPanel1.getWidth()/2)-44,240);
          c.drawString("OPTIONS",(jPanel1.getWidth()/2)-28,260);
          c.drawString("CHEATS",(jPanel1.getWidth()/2)-24,280);
          c.drawString("EXIT",(jPanel1.getWidth()/2)-16,300);
          c.drawString("Programming by Thomas Lorentsen",(jPanel1.getWidth()/2)-104,jPanel1.getHeight()-20);
          c.drawString("Graphics by Craig Taft",(jPanel1.getWidth()/2)-77,jPanel1.getHeight()-5);
    //-------------------------panel------------------------------------------------
      JPanel jPanel2 = new JPanel() {
        public void paintComponent(Graphics g) {
          dim = getSize();
          offscreen = createImage(dim.width,dim.height);
          bufferGraphics = offscreen.getGraphics();
          Graphics2D c = (Graphics2D)g;
          bufferGraphics.clearRect(0,0,dim.width,dim.height);
          for (int i = 0; i!=4;i++) {
            if (-50 < planetpos[1] && 600 > planetpos[i][1]) {
    bufferGraphics.drawImage(planets[planetpos[i][2]],planetpos[i][0]-spacepos,planetpos[i][1],this);
    //bufferGraphics.clearRect(0,0,jPanel2.getWidth(),jPanel2.getHeight());
    bufferGraphics.setColor(Color.white);
    bufferGraphics.drawImage(spaceships[0],playerpos[0]-15,playerpos[1]-15,this);
    if (weapon == 2) {
    bufferGraphics.drawLine(playerpos[0]+7,playerpos[1]+chaingunpos[0],playerpos[0]+11,playerpos[1]+chaingunpos[0]);
    for (int i = 0; i != 100; i++) {
    if (playerlasers[i][0] > 0) {
    if(playerlasers[i][2] == 0) {
    bufferGraphics.setColor(Color.yellow);
    bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
    else if(playerlasers[i][2] == 1) {
    bufferGraphics.setColor(Color.green);
    bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
    else if(playerlasers[i][2] == 2) {
    bufferGraphics.setColor(Color.getHSBColor(100,100,20));
    bufferGraphics.drawLine(playerlasers[i][0]-3,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
    else if(playerlasers[i][2] == 3) {
    bufferGraphics.setColor(Color.white);
    bufferGraphics.drawLine(playerlasers[i][0]-3,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
    else if(playerlasers[i][2] == 4) {
    bufferGraphics.setColor(Color.green);
    bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1]-2,playerlasers[i][0],playerlasers[i][1]);
    bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1]+2,playerlasers[i][0],playerlasers[i][1]);
    //bufferGraphics.drawString("Ship: " + playerlasers[3],playerlasers[i][0],playerlasers[i][1]+15);
    else if(playerlasers[i][2] == 5) {
    bufferGraphics.setColor(Color.yellow);
    bufferGraphics.drawRoundRect(playerlasers[i][0]-1,playerlasers[i][1]-1,3,3,3,3);
    bufferGraphics.setColor(Color.red);
    bufferGraphics.drawRect(playerlasers[i][0],playerlasers[i][1],0,0);
    else if(playerlasers[i][2] == 6) {
    bufferGraphics.setColor(Color.yellow);
    bufferGraphics.drawLine(playerlasers[i][0]-5,playerlasers[i][1],playerlasers[i][0],playerlasers[i][1]);
    bufferGraphics.setColor(Color.yellow);
    bufferGraphics.drawLine(playerlasers[i][0]+playerlasers[i][3],playerlasers[i][1],playerlasers[i][0]+playerlasers[i][3]+5,playerlasers[i][1]+5);
    else if(playerlasers[i][2] == 7) {
    bufferGraphics.setColor(Color.yellow);
    bufferGraphics.drawRoundRect(playerlasers[i][0]-5,playerlasers[i][1]-5,10,10,5,5);
    bufferGraphics.setColor(Color.yellow);
    //Enemy lasers
    else if(playerlasers[i][2] == 50) {
    bufferGraphics.setColor(Color.green);
    bufferGraphics.drawLine(playerlasers[i][0],playerlasers[i][1],playerlasers[i][0]-5,playerlasers[i][1]);
    if (packet[0] > 0) {
    bufferGraphics.setColor(Color.yellow);
    bufferGraphics.fillRect(packet[0],packet[1]-5,10,10);
    bufferGraphics.setColor(Color.white);
    for (int i = 0; i != 50; i++) {
    if (ship[i][0] > 0) {
    bufferGraphics.drawImage(spaceships[ship[i][2]],ship[i][0],ship[i][1]-15 ,this);
    //else {
    //break;
    bufferGraphics.setFont(bigtext);
    bufferGraphics.drawString("Score: " + score + " X " + multiplyer, 20, 20);
    bufferGraphics.drawString("Level: " + level, 500, 20);
    bufferGraphics.drawString("Weapon: " + weaponname[weapon], 300, 20);
    bufferGraphics.setFont(smalltext);
    bufferGraphics.drawRect(75,25,shield[1],14);
    bufferGraphics.drawString("Shield",25,38);
    bufferGraphics.fillRect(75,25,shield[0],14);
    bufferGraphics.setFont(smalltext);
    bufferGraphics.drawRect(260,25,weaponammo[weapon],14);
    bufferGraphics.drawString("Ammo",200,38);
    bufferGraphics.fillRect(260,25,weaponammo[weapon],14);
    bufferGraphics.setColor(Color.black);
    bufferGraphics.drawString(""+weaponammo[weapon],270,38);
    if (keys[107] == true || keys[109] == true) {
    bufferGraphics.setColor(Color.green);
    bufferGraphics.drawString("Speed: " + gamespeed, 250,250);
    c.drawImage(offscreen,0,0,this);
    class display implements Runnable {
    public void run() {
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    while(true) {
    repaint();
    //try {
    //Thread.sleep(1);
    //} catch (InterruptedException e){}
    //sleepy = false;
    class animatemenu implements Runnable {
    public void run() {
    while(ismenu == true) {
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e){}
    menuspace+=10;
    if (menuspace > jPanel1.getWidth()) {
    menuspace = -10;
    //=============================GAME=============================================
    class gamebuttons implements Runnable {
    boolean slowdown = false;
    private long timer = 0;
    public void run() {
    //Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    while(isgame == true) {
    for (int i = 0; i != 100; i++) {
    if (playerlasers[i][0] > 500 || playerlasers[i][0] < 0) {
    playerlasers[i][0] = 0;
    else if (playerlasers[i][0] > 0) {
    if (playerlasers[i][2] == 3) {
    playerlasers[i][1]+=playerlasers[i][3];
    playerlasers[i][0]+=10;
    if (playerlasers[i][2] == 4) {
    if (ship[playerlasers[i][3]][0] < playerlasers[i][0]) {
    int pX = playerlasers[i][0];
    int pY = playerlasers[i][1];
    int closeNdx = -1;
    int closeSq = Integer.MAX_VALUE;
    for (int ii = 0; ii != maxship; ii++) {
    int dx = pX - ship[ii][0];
    int dy = pY - ship[ii][1];
    int distSq = dx * dx + dy * dy;
    if (distSq < closeSq) {
    closeNdx = ii;
    closeSq = distSq;
    playerlasers[i][3] = closeNdx;
    playerlasers[i][0]+=5;
    else {
    int temp1 = ship[playerlasers[i][3]][0]-playerlasers[i][0];
    int temp2 = ship[playerlasers[i][3]][1]-playerlasers[i][1];
    playerlasers[i][0]+=5;
    if (temp1 != 1 && temp1 != 0 && temp2 != 0) {
    playerlasers[i][1]+= temp2/5;
    if (playerlasers[i][2] == 7) {
    if (ship[playerlasers[i][3]][0] < playerlasers[i][0]) {
    int pX = playerlasers[i][0];
    int pY = playerlasers[i][1];
    int closeNdx = -1;
    int closeSq = Integer.MAX_VALUE;
    for (int ii = 0; ii != maxship; ii++) {
    int dx = pX - ship[ii][0];
    int dy = pY - ship[ii][1];
    int distSq = dx * dx + dy * dy;
    if (distSq < closeSq) {
    closeNdx = ii;
    closeSq = distSq;
    playerlasers[i][4] = closeNdx;
    playerlasers[i][0]+=5;
    else {
    int temp1 = ship[playerlasers[i][4]][0]-playerlasers[i][0];
    int temp2 = ship[playerlasers[i][4]][1]-playerlasers[i][1];
    playerlasers[i][0]+=5;
    if (temp1 != 1 && temp1 != 0 && temp2 != 0) {
    playerlasers[i][1]+= temp2/5;
    else if (playerlasers[i][2] == 6) {
    playerlasers[i][0]+=10;
    if (playerlasers[i][3] == 4)
    playerlasers[i][3] = -1;
    playerlasers[i][3]++;
    else if (playerlasers[i][2] == 50) {
    playerlasers[i][0]-=playerlasers[i][3];
    else {
    playerlasers[i][0]+=10;
    for (int ii = 0; ii != maxship; ii++){
    if (playerlasers[i][0] != 0 && playerlasers[i][0] > ship[ii][0]-spaceshipsize[ship[ii][2]][0] && playerlasers[i][0] < ship[ii][0]+spaceshipsize[ship[ii][2]][0] && playerlasers[i][1] > ship[ii][1]-spaceshipsize[ship[ii][2]][1] && playerlasers[i][1] < ship[ii][1]+spaceshipsize[ship[ii][2]][1] && playerlasers[i][2] < 50){
    ship[ii][3]-= weaponpower[weapon];
    if (playerlasers[i][2] == 7) {
    littlemines(playerlasers[i][0],playerlasers[i][1],shipspecs[ship[ii][2]][0],playerlasers[i][3]);
    if (ship[ii][3] <= 0) {
    ship[ii][0] = 0;
    if (multiplyertime > System.currentTimeMillis()) {
    multiplyer++;
    multiplyerok = true;
    new Thread(new multiply()).start();
    multiplyertime = System.currentTimeMillis()+1000;
    //maxship++;
    score+= shipspecs[ship[ii][2]][2]*multiplyer;
    if (score >= nextscore) {
    level++;
    nextscore*=2;
    maxship++;
    playerlasers[i][0] = 0;
    playerlasers[i][1] = 0;
    playerlasers[i][2] = 0;
    playerlasers[i][3] = 0;
    else if (playerlasers[i][0] != 0 && playerlasers[i][0] > playerpos[0]-spaceshipsize[0][0] && playerlasers[i][0] < playerpos[0]+spaceshipsize[0][0] && playerlasers[i][1] > playerpos[1]-spaceshipsize[0][1] && playerlasers[i][1] < playerpos[1]+spaceshipsize[0][1] && playerlasers[i][2] > 49) {
    shield[0] = 0;
    for (int i = 0; i != maxship; i++) {
    if (ship[i][0] <= 0) {
    ship[i][0] = 500;
    ship[i][1] = r.nextInt(400)+50;
    ship[i][2] = r.nextInt(3)+1;
    ship[i][3] = shipspecs[ship[i][2]][0];
    break;
    else {
    ship[i][0]-=shipspecs[ship[i][2]][1];
    if (r.nextInt(50) == 0 && shiplasertimer[i] < System.currentTimeMillis()) {
    enemylaser(i);
    if (r.nextInt(100) == 0 && packet[0] == 0) {
    packet[0] = 500;
    packet[1] = r.nextInt(400)+50;
    packet[2] = 1;
    if (packet[0] <= 0) {
    packet[0] = 0;
    else if (packet[0] >0) {
    packet[0]-=1;
    if (packet[0] > playerpos[0]-spaceshipsize[0][0] && packet[0] < playerpos[0]+spaceshipsize[0][0] && packet[1] > playerpos[1]-spaceshipsize[0][1] && packet[1] < playerpos[1]+spaceshipsize[0][1]) {
    packet[0] = 0;
    weaponammo[weapon]+=100;
    if (keys[32] == true && bullettime < System.currentTimeMillis()) {
    if (weapon == 0 && shield[0] > 10)
    laser();
    else if (weapon == 1 && shield[0] > 20)
    duallaser();
    else if (weapon == 2 && weaponammo[weapon] > 1)
    chaingun();
    else if (weapon == 3 && weaponammo[weapon] > 1)
    flak();
    else if (weapon == 4 && weaponammo[weapon] > 1)
    homer();
    else if (weapon == 5 && weaponammo[weapon] > 1)
    blaster();
    else if (weapon == 6 && weaponammo[weapon] > 1)
    railgun();
    else if (weapon == 7 && weaponammo[weapon] > 1)
    mine();
    if (shield[0] < shield[1])
    shield[0]+= shield[2];
    if (keys[38] == true && playerpos[1] > 50) {
    playerpos[1]-=5;
    else if (keys[40] == true && playerpos[1] < 450) {
    playerpos[1]+=5;
    if (keys[37] == true && playerpos[0] > 30) {
    playerpos[0]-=3;
    else if (keys[39] == true && playerpos[0] < 500) {
    playerpos[0]+=3;
    if (keys[49] == true) {
    weapon = 0;
    else if (keys[50] == true) {
    weapon = 1;
    else if (keys[51] == true) {
    weapon = 2;
    else if (keys[52] == true) {
    weapon = 3;
    else if (keys[53] == true) {
    weapon = 4;
    else if (keys[54] == true) {
    weapon = 5;
    else if (keys[55] == true) {
    weapon = 6;
    else if (keys[56] == true) {
    weapon = 7;
    else if (keys[57] == true) {
    weapon = 8;
    else if (keys[58] == true) {
    weapon = 9;
    else if (keys[48] == true) {
    weapon = 10;
    else if (keys[97] == true) {
    weaponammo[weapon]+=100;
    else if (keys[98] == true) {
    score+=1000;
    else if (keys[99] == true) {
    level++;
    else if (keys[100] == true) {
    maxship++;
    else if (keys[101] == true) {
    shield[2]++;
    else if (keys[107] == true) {
    gamespeed++;
    else if (keys[109] == true && gamespeed > 1) {
    gamespeed--;
    else if (keys[27] == true && gamespeed > 1) {
    isgame = false;
    ismenu = true;
    menuchoice = 1;
    new Thread(new animatemenu()).start();
    new Thread(new menuchoiceselection()).start();
    setpanel("jPanel1");
    try {
    Thread.sleep(gamespeed);
    } catch (InterruptedException e){}
    spacepos+=1;
    if (spacepos > 1600)
    spacepos = 0;
    class multiply implements Runnable {
    public void run() {
    //Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    multiplyerok = false;
    try {
    Thread.sleep(1000);
    } catch (InterruptedException ie) {}
    if (multiplyerok == false) {
    multiplyer = 1;
    class menuchoiceselection implements Runnable {
    public void run() {
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    while(ismenu == true) {
    try {
    Thread.sleep(1);
    } catch (InterruptedException e){}
    if (keys[38] == true && menuchoice > 0) {
    menuchoice--;
    try {
    Thread.sleep(200);
    } catch (InterruptedException e){}
    else if (keys[40] == true && menuchoice < 5) {
    menuchoice++;
    try {
    Thread.sleep(200);
    } catch (InterruptedException e){}
    else if (keys[10] == true && menuchoice == 0) {
    System.out.println("Play");
    ismenu = false;
    isgame = true;
    reset();
    //new Thread(new bg()).start();
    new Thread(new gamebuttons()).start();
    //new Thread(new animategame()).start();
    setpanel("jPanel2");
    else if (keys[10] == true && menuchoice == 1) {
    System.out.println("Continue");
    ismenu = false;
    isgame = true;
    //new Thread(new bg()).start();
    new Thread(new gamebuttons()).start();
    //new Thread(new animategame()).start();
    setpanel("jPanel2");
    else if (keys[10] == true && menuchoice == 2) {
    System.out.println("High scores");
    else if (keys[10] == true && menuchoice == 3) {
    System.out.println("Options");
    else if (keys[10] == true && menuchoice == 4) {
    System.out.println("Cheats");
    cheat();
    else if (keys[10] == true && menuchoice == 5) {
    System.out.println("BOOM");
    System.exit(0);
    void this_keyPressed(KeyEvent e) {
    keys[e.getKeyCode()] = true;
    //System.out.println("Key: \t" + e.getKeyCode());
    void this_keyReleased(KeyEvent e) {
    keys[e.getKeyCode()] = false;
    void setpanel(String panel) {
    cc.show(this.getContentPane(),panel);
    void cheat() {
    String cheater = JOptionPane.showInputDialog(this,"Enter Cheat","Cheat",JOptionPane.QUESTION_MESSAGE);
    if (cheater.equals("giveall")) {
    String ok = JOptionPane.showInputDialog(this,"Cheat Accepted","Cheat",JOptionPane.OK_OPTION);
    void laser() {
    bullettime = System.currentTimeMillis()+250;
    for (int i = 0; i!=100;i++) {
    if (playerlasers[i][0] == 0){
    playerlasers[i][0] = playerpos[0]+20;
    playerlasers[i][1] = playerpos[1];
    playerlasers[i][2] = 0;
    shield[0]-=10;
    break;
    void duallaser() {
    bullettime = System.currentTimeMillis()+250;
    int count = 0;
    for (int i = 0; i!=100;i++) {
    if (playerlasers[i][0] == 0){
    if (count == 0) {
    playerlasers[i][0] = playerpos[0]+20;
    playerlasers[i][1] = playerpos[1]-5;
    playerlasers[i][2] = 1;
    count++;
    else if (count == 1) {
    playerlasers[i][0] = playerpos[0]+20;
    playerlasers[i][1] = playerpos[1] +5;
    playerlasers[i][2] = 1;
    shield[0]-=20;
    break;
    void chaingun(){
    bullettime = System.currentTimeMillis()+100;
    if (chaingunpos[0] >= 8)
    chaingunpos[1] = 1;
    else if (chaingunpos[0] <= -8)
    chaingunpos[1] = 0;
    if (chaingunpos[1] == 0)
    chaingunpos[0]+= 3;
    else if (chaingunpos[1] == 1)
    chaingunpos[0]-= 3;
    for (int i = 0; i!=100;i++) {
    if (playerlasers[i][0] == 0){
    playerlasers[i][0] = playerpos[0]+20;
    playerlasers[i][1] = playerpos[1]+chaingunpos[0];
    playerlasers[i][2] = 2;
    weaponammo[weapon]--;
    break;
    void flak(){
    bullettime = System.currentTimeMillis()+1000;
    int count = -10;
    for (int i = 0; i!=100;i++) {
    if (playerlasers[i][0] == 0){
    if (count < 5) {
    //playerlasers[i][0] = playerpos[0]+20;
    //playerlasers[i][1] = playerpos[1]+count;
    playerlasers[i][0] = playerpos[0]+r.nextInt(10)+10;
    playerlasers[i][1] = playerpos[1]+(r.nextInt(10)-5);
    playerlasers[i][2] = 3;
    playerlasers[i][3] = count;
    if (count == 10) {
    weaponammo[weapon]-=10;
    break;
    count+=2;
    void homer() {
    bullettime = System.currentTimeMillis()+500;
    int[] small = {10000,10000};
    for (int i = 0; i!=100;i++) {
    if (playerlasers[i][0] == 0){
    playerlasers[i][0] = playerpos[0]+20;
    playerlasers[i][1] = playerpos[1];
    playerlasers[i][2] = 4;
    weaponammo[weapon]-=1;
    int pX = playerpos[0];
    int pY = playerpos[1];
    int closeNdx = -1;
    int closeSq = Integer.MAX_VALUE;
    for (int ii = 0; ii != maxship; ii++) {
    int dx = pX - ship[ii][0];
    int dy = pY - ship[ii][1];
    int distSq = dx * dx + dy * dy;
    if (distSq < closeSq) {
    closeNdx = ii;
    closeSq = distSq;
    playerlasers[i][3] = closeNdx;
    break;
    void blaster() {
    bullettime = System.currentTimeMillis()+100;
    for (int i = 0; i!=100;i++) {
    if (playerlasers[i][0] == 0){
    playerlasers[i][0] = playerpos[0]+20;
    playerlasers[i][1] = playerpos[1]+(r.nextInt(5)-2);
    playerlasers[i][2] = 5;
    weaponammo[weapon]--;
    break;
    void railgun() {
    bullettime = System.currentTimeMillis()+300;
    for (int i = 0; i!=100;i++) {
    if (playerlasers[i][0] == 0){
    playerlasers[i][0] = playerpos[0]+20;
    playerlasers[i][1] = playerpos[1];
    playerlasers[i][2] = 6;
    playerl

    Did you get any compile errors?
    Are you getting any messages/exceptions at runtime?
    The same code, compiled with a jdk 1.2 works fine?
    (( You've tested this.. (my thought is that maybe somewhere you changed something but didn't recompile that has no broken execution...) you've compiled those specific files with the old jdk, just to make sure))

  • How to modify an existing xml file from java code.

    Hi
    I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
    For example if xml file(studlist.xml) is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    Now suppose i have set name to victor using student.setName,
    and set age to 20 using setAge from javacode,
    the new xml file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    <Student>
              <Name>victor</Name>
              <Age>20</Age>
         </Student>
    As observed this is not a valid xml file.But how can i modify without any errors?

    I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
    Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
    What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
    // gets the root element of the specified file (code not shown)
    Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
    // write a new student element
    Element student = document.createElement("Student");  // creates the new student
    rootElement.appendChild(student); // ***appends it to the root element***
    Element name = document.createElement("Name"); // creates the name element
    name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
    student.appendChild(name); // appends the name to the student
    Element age= document.createElement("Age"); // creates the age element
    age.appendChild(document.createTextNode("26")); // adds the age text to the age element
    student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
    Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM

  • Not able to checkout Files using Java Code and SAP BAPI  from DMSServer

    Hi
    Able to download / checkout the files using T-Code SE37 (BAPI_DOCUMENT_CHECKOUTVIEW2).
    But when same RFC is executed from Java, it alsways says -
    Message ::::::::Document LGL/10000000003/000/00 does not exist
    My inputs in Java Code is as below -
    import java.io.*;
    import java.util.*;
    import com.sap.mw.jco.*;
    //CREATED ON - 10-APRIL-2010.
    public class BapiDocCheckOutview {
         public static void main(String args[]){
              try{
                   if(mConnection!=null){
    JCO.Repository repository=new JCO.Repository("AraSoft",mConnection);
    JCO.setMiddlewareProperty("jco.middleware.allow_start_of_programs", "SAPFTPA");
    JCO.Function function=repository.getFunctionTemplate("BAPI_DOCUMENT_CHECKOUTVIEW2").getFunction();
                        //End of get function.
                     System.out.println("Before execution1");
                     if(function !=null){
                   JCO.Field DOCUMENTTYPE = function.getImportParameterList().getField("DOCUMENTTYPE");
                    DOCUMENTTYPE.setValue("LGL");
                    JCO.Field DOCUMENTNUMBER = function.getImportParameterList().getField("DOCUMENTNUMBER");
                    DOCUMENTNUMBER.setValue("10000000003");
                    JCO.Field DOCUMENTPART = function.getImportParameterList().getField("DOCUMENTPART");
                    DOCUMENTPART.setValue("000");
                    JCO.Field DOCUMENTVERSION = function.getImportParameterList().getField("DOCUMENTVERSION");
                    DOCUMENTVERSION.setValue("00");
                    JCO.Field GETSTRUCTURE = function.getImportParameterList().getField("GETSTRUCTURE");
                    GETSTRUCTURE.setValue("1");
    JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
                 GETCOMPONENTS.setValue("X");
    JCO.Field ORIGINALPATH = function.getImportParameterList().getField("ORIGINALPATH");
                  ORIGINALPATH.setValue("C:
    TEMP
    DMS_");
    JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
                          GETHEADER.setValue("X");
    JCO.Field PF_FTP_DEST=function.getImportParameterList().getField("PF_FTP_DEST");
              PF_FTP_DEST.setValue("SAPFTPA");
    //JCO.Field PF_HTTP_DEST=function.getImportParameterList().getField("PF_HTTP_DEST");
         //PF_HTTP_DEST.setValue("SAPHTTPA");
                          System.out.println("Here Setting Values Inside Structure ::DOCUMENTFILE");
    JCO.Structure DOCUMENTFILE=function.getImportParameterList().getStructure("DOCUMENTFILE");
    DOCUMENTFILE.setValue("1","ORIGINALTYPE");
    DOCUMENTFILE.setValue("WWI","WSAPPLICATION");
    DOCUMENTFILE.setValue("ZHCL_CS","STORAGECATEGORY");
    DOCUMENTFILE.setValue("E0DF7893E2BD5DF19C07001517B4A299","APPLICATION_ID");
    DOCUMENTFILE.setValue("E0DF7893E2BD5FF19C07001517B4A299","FILE_ID");
    DOCUMENTFILE.setValue("X","CHECKEDIN");
    DOCUMENTFILE.setValue("X","ACTIVE_VERSION");
                            //DOCUMENTFILE.setValue("LGL","DOCUMENTTYPE");
                            //DOCUMENTFILE.setValue("10000000003","DOCUMENTNUMBER");
                            //DOCUMENTFILE.setValue("000","DOCUMENTPART");
                            //DOCUMENTFILE.setValue("00","DOCUMENTVERSION");
                          //JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
                          //GETCOMPONENTS.setValue("X");
                          //JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
                          //GETHEADER.setValue("X");
                        mConnection.execute(function);
    If anyone have an Idea on what I have missed out...
    Please do advice me.
    Thanks
    Prashant

    Hi
    To update in the initial requirement, I have added (prefixed, zeroes) in Document No., doing that, now the  application is able to find the document, but not able to transfer the same from DMS Server to my local Machine, always giving the following error -
    Type ::::::::E
    Message ::::::::File d:\dms\z_IPI_PRASHANT01.doc cannot be created
    Please let me know, if some services needed to checked in SAP System or some more information to be provided in RFC.
    Thanks
    Prashant
    Dear Experts
    Any advice on this. Still not able to download the documents from DMS Server.
    I have also added few more code in my Java program -
         private int use_sapgui;
         public void setSapGui(int use_sapgui){
              use_sapgui = 2;
    PLease help !!
    Regards
    Edited by: Prashantroy on Sep 26, 2011 12:49 PM
    Hi,
    Further to my earlier Mail, while checking the Trace suing SM59 in ECC System I got  the following Error -
    Trace file opened at 20111010 142232 India Standard Time, SAP-REL 701,0,134
    ======> cannot open SAPGUI
    ABAP Programm: SAPLSYSE (Transaction: )
    User: IPI_PRASHANT (Client: 220)
    Destination: SAPFTP (handle: 3, , )
    SERVER> RFC Server Session (handle: 1, 43220900, {5D1DF3E0-ACBD-F11F-8EA0-00A0D1
    SERVER> Caller host:
    SERVER> Caller transaction code:  (Caller Program: java)
    SERVER> Called function module: RFC_START_PROGRAM
    Error RFCIO_ERROR_SYSERROR in abrfcpic.c : 1742
    FUNCTION: 'exec_sapgui'
    cannot open SAPGUI
    PROG =sapftp erpdev sapgw00 43232164 IDX=4
    Can someone help me in getting this sorted out.
    Thanks N Regards
    Edited by: Prashantroy on Oct 10, 2011 2:32 PM

  • How to convert old Java Servlets to OSGi "Servlet" Bundles

    Hello I'm looking for some help/insight on the best way to convert some of our old Java Servlet code into new OSGi Bundles that can be accessed as servlets.  I'd like to be able to install the new bundles then access them on one of our CQ instance using something like "/servlet/servlet_name".
    So far I've been able to create a new bundle, and install it into CQ but I haven't been able to access the bundle at the servlet mapping URL that I would expect.  So far what I've found online has lead me to believe that I need to use the Felix Annotations to describe my servlet.
    @Component(immediate = true, metatype = true, label = "Servlet Name")
    @Service
    @Properties({
        @Property(name = Constants.SERVICE_DESCRIPTION, value = "Servlet Name"),
        @Property(name = "sling.servlet.methods", value={"GET"}),
        @Property(name = "sling.servlet.paths", value = "/servlet/my_servlet_mapping"),
        @Property(name = Constants.SERVICE_VENDOR, value = "VendorName")
    public class TellAFriend extends HttpServlet {...
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
    Once I have this installed, and running without an error in the logs for CQ I tried to go on my local instance to http://localhost:4502/servlet/my_servlet_mapping but I only get 404 Resource Not Found errors.  I've even gone to the Sling Resource Resolver and it doesn't resolve to anything either.
    Is there more than the Servlet Information need into the Annotations to convert "old" code into a new OSGi Servlet Mapped Bundle?

    I must be missing something else configuration wise since I created a new Servlet basically using the code you provided above.  I deployed it as part of the bundle that I'm trying to create.
    The bundle installs and stars fine but I still can't access the servlet.  Are there CRXDE based configurations that are requried too to configure Servlets. 
    Here's my test servlet file.  I tried going to http://localhost:4502/servlet/TestCQServlet and just get the same 404 error I'm getting for the other 2 Servlets Java classes in my Bundle.
    import java.io.IOException;
    import javax.servlet.ServletException;
    import org.apache.felix.scr.annotations.sling.SlingServlet;
    import org.apache.sling.api.SlingHttpServletRequest;
    import org.apache.sling.api.SlingHttpServletResponse;
    import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
    @SlingServlet(paths = "/servlet/TestCQServlet", methods = "GET")
    public class TestCQServlet extends SlingSafeMethodsServlet {
        // @Reference
        // private Repository repository;
        private static final long serialVersionUID = 6239754936223276983L;
        @Override
        protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
            response.setHeader("Content-Type", "application/json");
            response.getWriter().print("whatever");

  • What is wrong in this java code?

    Can someone please tell me what is wrong in this java code?
    /* The program is intended to start animating text at the click of a button, pause it at another click and resume at the next click. It should continue like this */
    import javax.swing.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TextAnime implements Runnable
    JFrame frame;
    boolean flag;
    Thread animeThread;
    JLabel label;
    String[] textArray;
    public TextAnime()
    flag = false;
    animeThread = new Thread(this);
    frame = new JFrame("Animate Text");
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    frame.setLayout(gbl);
    JButton button = new JButton("Start");
    label = new JLabel("Stopped");
    textArray = new String[5];
    String textArray1[] = {"Programmer", "SportsMan", "Genius", "Friend", "Knowledgable"};
    for(int ctr = 0; ctr<5 ; ctr++)
    textArray[ctr] = textArray1[ctr];
    gbc.weightx = 1;
    gbc.gridx = 0;
    gbl.setConstraints(button,gbc);
    frame.getContentPane().add(button);
    ButList bl = new ButList();
    button.addActionListener(bl);
    gbc.gridx = 1;
    gbl.setConstraints(label,gbc);
    frame.getContentPane().add(label);
    frame.setSize(200,150);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    frame.setVisible(true);
    public class ButList implements ActionListener
    public void actionPerformed(ActionEvent evt)
    if(flag == false)
    flag = true;
    animeStart();
    else
    flag = false;
    //animeStop();
    public synchronized void animeStart()
    animeThread.start();
    Thread newThread;
    newThread = Thread.currentThread();
    newThread.notify();
    public void animeStop()
    animeThread.interrupt();
    public void run()
    int i = 0;
    try
    while(i == i)
    if(i==5)
    i=0;
    label.setText(textArray);
    animeThread.sleep(1000);
    i++;
    if (flag == false)
    animeThread.wait();
    catch(InterruptedException ie)
    label.setText("Stopped");
    public static void main(String args[])
    TextAnime ta = new TextAnime();
    Please tell me if this can be written in a more simpler manner. Also please correct this code. I am tired after trying many times.

    When I fix your error, compile and run it, I get this exception:
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalMonitorStateException
         at java.lang.Object.notify(Native Method)
         at cruft.TextAnime.animeStart(TextAnime.java:81)
         at cruft.TextAnime$ButList.actionPerformed(TextAnime.java:63)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    %

  • How to execute SAPgui.exe from java code

    Hi All,
    Can any one provide me the exe file name of SAP GUI related.
    I need to call the SAP GUI related exe file from java.
    i tried with a small java prog which executes the exe files.
    it works fine with notepad.exe,javac.exe . But i am unable to execute the SAPgui.exe.
    This is my java code
    try{
         Runtime rt=Runtime.getRuntime();
    //String str= "C:
    WINNT
    system32
    notepad.exe";
    //Process pp=rt.exec("C:
    j2sdk1.4.2_08
    bin
    javac");
    Process pp=rt.exec("C:
    Program Files
    SAP
    FrontEnd
    SAPgui
    SAPgui.exe");
    BufferedReader br=new BufferedReader(new InputStreamReader(pp.getErrorStream()));
                         String line;
                         while ((line = br.readLine()) != null) {
                             System.out.println(line);
              }catch(Exception e){
                   System.out.println(e);
    and may i pass any additional parameters inorder to invoke this exe.
    Please share your ideas abt  this problem.
    Its Urgent PLZ
    Adv Thanks
    Regds
    Phani.

    hi Rajesh,
    here my complete code:
              try{
                   Runtime rt=Runtime.getRuntime();
    //               String str= "C:\Programmi\SAP\FrontEnd\SAPgui\saplogon.exe";
                   String str= "C:\Programmi\SAP\FrontEnd\SAPgui\Sapgui.exe 10.113.10.201 00";
                   //               Process pp=rt.exec("C:\j2sdk1.4.2_08\bin\javac");
                   Process pp=rt.exec(str);
                   BufferedReader br=new BufferedReader(new InputStreamReader(pp.getErrorStream()));
                   String line;
                   while ((line = br.readLine()) != null) {
                   System.out.println(line);
                   }catch(Exception e){
                   System.out.println(e);
    Please note that system number is only two digit and in your case is 00.
    Another important think, i'm using the italian version of windows, so the program directory is c:\programmi, please change into c:\program files, or you can modify your code to be language indipendend using an system environment variable (if exist).
    Hope this help
    Francesco

Maybe you are looking for

  • Problem with Jtree to xml tranform..how to set/get parent of a node?

    Hi, I am trying to develop xml import/export module.In import wizard, I am parsing the xml file and the display it in Jtree view using xml tree model which implements TreeModel and xml tree node.I am using jaxp api.. It is workin fine. I got stuck wi

  • The same problem with samples

    Hello, When i tried to run AssociationRules sample i've got the following error: Completed MiningServer login Formed bin boundary objects: census_2d_build Created discretization tables for: census_2d_build Received an exception in main: ORA-00905: mi

  • Regarding user interface in LINUX for smartforms

    Hi Friends,            we run SAP on Linux platform.. we encountered a problem that , when we open SMARTFORMS   Tcode and create a new form,  it says that the user interface for the function is not supported by the OS.. what is the remedy for this..

  • Missing episode 6 of upstairs downstairs

    Is anyone missing the last episode of Season Two of Upstairs Downstairs. It was aired awhile ago, but i do not see the Episode 6 posted for download.

  • Wie man Diskussionen nominiert und Kommentare hinterlässt

    Hinzufügen von Kommentaren Alle Mitglieder der Lenovo Community können Kommentare zu Artikeln hinterlassen. Dies ist eine großartige Möglichkeit alle Dokumente aktuell zu halten, weil der Verfasser oder Herausgeber des Artikels zurück kommen kann und