Help on simple String problem

Hello All:
I need to write the following line into a file.
The line is: <?xml version="1.0" endcoding="UTF-8"?>
Below is the excerpt of my code:
BufferWriter bw = new BufferedWriter(new FileWriter("test.xml"));
String str = "<?xml version="1.0" endcoding="UTF-8"?>";
bw.write(str+System.getProperty("line.separator");
When I complie this Java code, I encountered the "; is expected" error because the compiler thought that the string ends at "<?xml version=".
Can anyone tell me how to solve this problem?
Thanks!

Observe this:
String str = "<?xml version="1.0" endcoding="UTF-8"?>";
In this statement, the " is recognized as opening of string and closing of string. In this case, the string is ended like "<?xml version=", because its within the code. You might want to try something like:
String str = "<?xml version=\"1.0\" endcoding=\"UTF-8\"?>";
The \ character will make the subsequence characters in the string to be as a character in string, rather than a double quote to end the string until a " is met.

Similar Messages

  • Still Need Help with this String Problem

    basically, i need to create a program where I input 5 words and then the program outputs the number of unique words and the words themselves. for example, if i input the word hello 5 times, then the output is 1 unique word and the word "hello". i have been agonizing over this dumb problem for days, i know how to do it using hashmap, but this is an introductory course and we cannot use more complex java functions, does ANYONE know how to do this just using arrays, strings, for loops, if clauses, etc. really basic java stuff. i want the code to be able to do what the following program does:
    import java.io.*; import java.util.ArrayList;
        public class MoreUnique {
           public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = new String[5]; int uniqueEntries = 0; ArrayList<String> ue = new ArrayList<String>();
             for (int i = 0; i < 5; i++) { System.out.print((i +1) + ": "); str[i] = br.readLine(); }
             for (int j = 0; j < 5; j++) {
                if (!ue.contains(str[j].toLowerCase())) { ue.add(str[j].toLowerCase()); } } uniqueEntries = ue.size(); System.out.print("Number of unique entries: " + uniqueEntries + " { ");
             for (int q = 0; q < ue.size(); q++ ) { System.out.print(ue.get(q) + " "); } System.out.println("}"); } } but i need to find how to do it so all 5 words are put in at once on one line, and without all the advanced java functions that are in here, can anyone help out?

    you have to compare string 0 to strings 1-4, then
    string 1 with strings 2-4, then string 2 with strings
    3 and 4 then string 3 with string 4....right???Here's a way to do it:
    public class MoreUnique {
        public static void main(String[] args) throws IOException {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            final int NUM_WORDS = 5;
            String[] words = new String[NUM_WORDS];
            int uniqueEntries = 0;
            for(int i = 0; i < NUM_WORDS; i++) {
                System.out.print((i+1)+": ");
                String temp = br.readLine();
                if(!contains(temp, words)) {
                    words[uniqueEntries++] = temp;
            System.out.print("Number of unique entries: "+uniqueEntries+" { ");   
            for (int i = 0; i < uniqueEntries; i++ ) {   
                System.out.print(words[i]+" ");
            System.out.println("}");
        private static boolean contains(String word, String[] array) {
                 Your code here: just a simple for-statement to
                 loop through your array and to see if 'word'
                 is in your 'array'.
    }Try to fill in the blanks.
    Good luck.

  • Need help with simple mask problem

    hi there this is mark from superbooty a band that has played in the bay area for over 10 years...
    i was wondering if someone could help me with a Motion2 problem i'm having regarding masks.
    i'm working on this simple animated scene of a car going by a beach - the photo is from the passenger side and shows the outside mirror.
    i'm moving the background (different from the original that came with the car) and i want to move an image of tokyo inside the mirror housing too.
    i figured out how to do the mask but when i try to animate the image of tokyo the mask layer moves with it. when i lock the mask i can't move the image - ???
    there's got to be a way to lock the mask but be able to move what it is masking..
    here are the links to three images that show what the problem is - the first is
    the shot of the scene unmasked, shot 2 is the scene with the mask enabled, and the third is the shot when i try to animate the tokyo background:
    http://superbooty.com/mirrorbeach1.jpg
    http://superbooty.com/mirrorbeach2.jpg
    http://superbooty.com/mirrorbeach3.jpg
    any help would be most appreciated - thanks!

    Adam's solution is the one I'd use - put the mirror contents in a layer, mask the layer, then manipulate the mirror content image. Did this solve it for you - if so, please click on the or buttons over posts as appropriate...
    Patrick

  • Can you help w/ simple io problem?

    i have this code and am expecting it to do a couple of things. first the code.
    import java.io.*;
    class BasicTests2 {
    public static void main(String[] args) {
    String input="";
    InputStreamReader converter = new InputStreamReader(System.in);
    BufferedReader in = new BufferedReader(converter);
    System.out.println("Please enter your name: ");
    while((System.in.read())!=-1) {
    input=in.readLine();
    System.out.println(input);
    } // end while
    } // main()
    } // BasicTests2
    my problems. one, when i enter a -1 the program does not exit. and secondly why does it cut the first char i enter when it echoes my entry back to me???
    thanks for any help,
    erik

    my problems. one, when i enter a -1 the program does
    not exit. The InputStream.read() method returns a -1 when the end of the stream has been reached. If the user enters a -1, then the end of the stream has not been reached. Entering a CTRL+Z will send the end of file marker indicating that the end of the stream has been reached.
    and secondly why does it cut the first char
    i enter when it echoes my entry back to me???This is because your code is reading in a byte of data (or one character), and then reading in a line of characters to echo back via System.out.println().
    Perhaps you could try something like this:
    import java.io.*;
    class BasicTests2 {
    public static void main(String[] args) {
    String input= new String();
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Please enter your name (-q to quit) : ");
    try {
    input=in.readLine();
    while(input !=null && !input.equalsIgnoreCase("-q")) {
    System.out.println(input);
    input=in.readLine();
    } // end while
    } catch (Exception e) {
    e.printStackTrace();
    } // main()
    } // BasicTests2

  • Help with "simple" JFileChooser problem...

    Hi all,
    how do I set the font in a JFileChooser???
    I have tried everything, but it always uses the Look & Feels default font setting. Can I change the default Look&Feels font setting?
    Greatfully for any suggestions!
    Cheers
    Anders ;-D

    Hello!
    You can use the UIManager, e.g. UIManager.put("FileChooser.font", new Font("Arial",
    Font.BOLD, 14);
    Well, that didn't seem to help with my case either. So I tried something else: I overrided all of the defaults by using UIManager.put(key, value) this way I got all of the Fonts in the JFileChooser to change.
    Correct me if I'm wrong... ;)
    - Cathra -
    Sample Code that performs the requested:
    // Prepare the resources
    FontUIResource font12Arial = new FontUIResource( "Arial", Font.PLAIN, 12 );
    // Put values into UIDefaults (before initializing the JFileChooser)
    UIManager.put( "ToolTip.font", font12Arial );
    UIManager.put( "OptionPane.messageFont", font12Arial );
    // shown for example
    UIManager.put("FileChooser.openButtonText", "OpenUp");
    UIManager.put("Button.font", font12Arial);
    UIManager.put("Label.font", font12Arial);
    UIManager.put("Table.font", font12Arial);
    UIManager.put("TextField.font", font12Arial);
    UIManager.put("ScrollPane.font", font12Arial);
    UIManager.put("ComboBox.font", font12Arial);
    UIManager.put("CheckBox.font", font12Arial);
    UIManager.put("TitledBorder.font", font12Arial);
    UIManager.put("RadioButton.font", font12Arial);
    UIManager.put("ToolTip.font", font12Arial);
    UIManager.put("TextPane.font", font12Arial);
    UIManager.put("TextArea.font", font12Arial);
    UIManager.put("Tree.font", font12Arial);
    UIManager.put("List.font", font12Arial);
    UIManager.put("MenuBar.font", font12Arial);
    UIManager.put("Menu.font", font12Arial);
    UIManager.put("MenuItem.font", font12Arial);
    UIManager.put("TableHeader.font", font12Arial);
    UIManager.put("TabbedPane.font", font12Arial);
    // somewhere in the code:
    JFileChooser c = new JFileChooser();
    c.showOpenDialog(aParentFrame);

  • Help! Simple Servlet Problem

    hi,
    I am new to servlets. I am trying to connect to database and retrive firstname and lastname and display it. When i run it i get a blank page. Can someone tell me what am i doing wrong.
    Here is the code.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.servlet.ServletException;
    public class DisplayAll extends HttpServlet{
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{
    res.setContentType("text/html");
    PrintWriter pw = res.getWriter();
    try{
    Class.forName("sun.jdbc.odbc.Jdbc.OdbcDriver");
    Connection myCon = DriverManager.getConnection
    ("jdbc:odbc:SCANODBC","SYSDBA", "masterkey");
    Statement myStmt = myCon.createStatement();
    myStmt.execute("SELECT * FROM PINFO WHERE POLICYNUMBER=B05007584");
    ResultSet mySet = myStmt.getResultSet();
    while(mySet.next()){
    String fname = mySet.getString("FIRSTNAME");
    String lname = mySet.getString("LASTNAME");
    pw.println("<html>");
    pw.println("<body>");
    pw.println("Firstname: " + fname);
    pw.println("Lastname: " + lname);
    pw.println("</body>");
    pw.println("</html>");
    myStmt.close();
    myCon.close();
    catch(SQLException e){
    catch(ClassNotFoundException e){
    }

    You are putting <HTML><BODY> inside the while loop. Try the following and also close the statement and connection in "finally" block as opposed to in "try" block itself.
    pw.println("<html>");
    pw.println("<body>");
    while(mySet.next()){
    String fname = mySet.getString("FIRSTNAME");
    String lname = mySet.getString("LASTNAME");
    pw.println("Firstname: " + fname);
    pw.println("Lastname: " + lname);
    } //end while()
    pw.println("</body>");
    pw.println("</html>");
    }//end try
    catch(SQLException e){
    finally
    myStmt.close();
    myCon.close();

  • HELP - Another simple JMS Problem

    I'm getting:
    JNDI API lookup failed: javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
    javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
    When I try to look up a JMS ConnectionFactory I've defined in Sun App Server. I'm not sure whether the protocol is correct...the documentation says to use "jmsmq" as the protocol, but I get "unsupported protocol" when I try that.
    Here is the code:
    package com.tpc.jms.simpleProducer;
    import javax.jms.*;
    import javax.naming.*;
    import java.util.Hashtable;
    import java.util.Properties;
    public class SimpleJMSTest {
    public static final String PROVIDER_URL = "iiop://localhost:3700";
    public static final String CONTEXT_FAC = "com.sun.jndi.cosnaming.CNCtxFactory";
    public static void main (String argv[]) {
         try {
    Properties properties = new Properties();
    properties.put(Context.PROVIDER_URL, PROVIDER_URL);
    properties.put(Context.INITIAL_CONTEXT_FACTORY, CONTEXT_FAC);
    properties.put(Context.SECURITY_PRINCIPAL, "guest");
    properties.put(Context.SECURITY_CREDENTIALS, "guest");
    properties.put("server.jms-service.init-timeout-in-seconds", "60");
    properties.put("server.jms-service.type", "EMBEDDED");
    properties.put("server.jms-service.start-args", "");
    properties.put("server.jms-service.default-jms-host", "default_JMS_host");
    properties.put("server.jms-service.reconnect-interval-in-seconds",60);
    properties.put("server.jms-service.reconnect-attempts", 3);
    properties.put("server.jms-service.reconnect-enabled", true);
    properties.put("server.jms-service.addresslist-behavior", "random");
    properties.put("server.jms-service.addresslist-iterations", 3);
    properties.put("server.jms-service.mq-scheme","mq");
    properties.put("server.jms-service.mq-service","jms");
    properties.put("server.jms-service.property.instance-name", "imqbroker");
    properties.put("server.jms-service.property.instance-name-suffix", "");
    properties.put("server.jms-service.property.append-version", false);
    properties.put("server.jms-service.property.user-name", "admin");
    properties.put("server.jms-service.property.password", "admin");
    InitialContext initialCtx = new InitialContext(properties);
    ConnectionFactory connectionFactory = null;
    Destination dest = null;
    try {
    connectionFactory = (ConnectionFactory) initialCtx.lookup(
    "jms/ConnectionFactory");
    } catch (Exception e) {
    System.out.println("JNDI API lookup failed: " + e.toString());
    e.printStackTrace();
    System.exit(1);
    catch (Exception e) {
    e.printStackTrace ();
    }

    why iiop?

  • Simple OOP Problem. Help!

    This is just a simple OOP problem that i cant decide on a best
    implementation for.
    im passing an object to an instance of, 'TabbedFrame', which is just
    a frame with a Tabbed Pane in it that is holding custom panels.
    however, these custom panels need access to the object being
    passed to 'TabbedFrame' and to some methods in it.
    i cant make them static however so how do i gain access to them?
    is my only option to pass the 'TabbedFrame' to each panel?
    like - jtabbedpane.add( "Panel 1", new mypanel1(this));
    here is code:
    new TabbedFrame( DataObject );
    public class TabbedFrame{
    public TabbedFrame(DataObject do){
    this.do = do;
    jtabbedpane.add( "Panel 1", new mypanel1() );
    DataObject do;
    public class mypanel1{
    public mypanel1(){
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    }i would just pass the DataObject to evey panel (there are 12) but
    i also need to be able to call methods in the 'TabbedFrame'.
    Any help would be appreciated!

    Modify mypanel1's constructor:
    public class mypanel1{
    TabbedFrame tf;
    public mypanel1(TabbedFrame tf){
    this.tf = tf;
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    DataObject theDo = tf.getDataObject();
    tf.someMethod(); // Call method on the TabbedFrame
    }In TabbedFrame:
    public TabbedFrame(DataObject do){
    this.do = do;
    // Modify call to constructor to pass "this" TabbedFrame.
    jtabbedpane.add( "Panel 1", new mypanel1(this) );
    }

  • URL: newbie needs help with simple programming question!

    Hi everyone,
    Please direct me to a FAQ or other resource, or help me with this problem:
    I want to create a text field (or similar container) that contains both ordinary text AND a URL/hyperlink in it. For example, the following text might appear in the text field:
    "I have many _pictures_ from my vacation"
    where the word "pictures" is actually a hyperlink to a web site, and the other portions of the string are simple text.
    All advice and help is appreciated!
    -Dennis Reda
    [email protected]

    Well here is one way you code do it but if you do alittle research on them links above it will explain how this code works.Well it will explain how jeditorpane and hyperlinklistener work
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.net.*;
    public class b extends javax.swing.JApplet implements HyperlinkListener  {
       JEditorPane field = new JEditorPane();
      public b() {
        Container pane = getContentPane();
        FlowLayout flo = new FlowLayout();
        pane.setLayout(flo);
        field.setPreferredSize(new Dimension(200, 25));
        field.setEditable(false);
        pane.add(field);
        setContentPane(pane);
         String gg1 = "<html><body>I have many_<a    href='http://www.home.com'>pictures</a>_from my vacation</body></html>";
         field.addHyperlinkListener(this);
         field.setContentType("text/html");
         field.setText(gg1);
      public void hyperlinkUpdate(HyperlinkEvent e) {
         if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          try{
            URL url = new URL("http://www.msn.com");
            getAppletContext().showDocument(url,"_self"); 
            }catch(Exception r) {};
      public void init()  {
         b c = new b();
    ps hope this helped                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • String problem

    BufferedReader reader = new BufferedReader(new FileReader(new File(filie)));
    String line;
    while ((line = reader.readLine()) != null) {
    StringTokenizer st = new StringTokenizer(line, "/");
    // System.out.println("st"+st);
    String path = st.nextToken();
    String url = st.nextToken();
    String perm = st.nextToken();
    String label = path.substring(path.lastIndexOf("/"+1));
    // I cannot compile after this line. Can anyone explain me why .I am getting following exception.
    String pathToNode = path.substring(0, path.indexOf("/"));
    System.out.println("this iis test");
    //String pathToNode = path.substring(0, path.l);
    //check for the root node
    if ("top".equalsIgnoreCase(label) && pathToNode.length() == 0) {
    root = new Node(root.getLabel());
    // root.setPerm(perm);
    // root.setUrl(url);
    nodes.put(path, root);
    } else {//other node
    Node parent = nodes.get(pathToNode);
    if (parent == null) {
    System.out.println("Parent node not found");
    System.exit(-1);
    Node child = new Node(label);
    //child.setPerm(perm);
    // child.setUrl(url);
    parent.getChildren().add(child);
    nodes.put(path, child);
    reader.close();
    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    I am getting an error when I am debugging pathtoNode line. I cannot debug it and I am getting above error. please help me on this problem
    thanks .
    m
    My file formate was like that
    file.txt
    /top/science/earth_science

    StringTokenizer st = new StringTokenizer(line, "/");
    String path = st.nextToken();
    // I cannot compile after this line. Can anyone explain me why .I am getting following exception.
    String pathToNode = path.substring(0, path.indexOf("/"));When you take path out of a StringTokenizer that delimits at slashes, how do you expect path to contain a slash?

  • Real simple xslt problem/question

    Hi, i have a real simple xslt problem but i just cant figure out how to do it by looking at various examples on the net. i have a xml document and in it are some elements with a "result" tag name. i want to use xslt to reproduce exactly the same xml document except with an attribute called "id" added to those elements with a "result" tag name. i'm sure that theres a simple solution to it but i just cant figure it out. any helps greatly appreciated, thanks

    Start with the XSLT identity transform (I don't have it handy and it's fairly long, but you should be able to google it up). Add this:<xsl:template match="result">
      <result id="">
        <xsl:apply-templates>
      </result>
    </xsl:template>

  • Please I really need help with this video problem.

    Hi!
    Please I need help with this app I am trying to make for an Android cellphone and I've been struggling with this for a couple of months.
    I have a main flash file (video player.fla) that will load external swf files. This is the main screen.When I click the Sets Anteriores button I want to open another swf file called sets.swf.The app is freezing when I click Sets Anteriores button
    Here is the code for this fla file.
    import flash.events.MouseEvent;
    preloaderBar.visible = false;
    var loader:Loader = new Loader();
    btHome.enabled = false;
    var filme : String = "";
    carregaFilme("home.swf");
    function carregaFilme(filme : String ) :void
      var reqMovie:URLRequest = new URLRequest(filme);
      loader.load(reqMovie);
      loader.contentLoaderInfo.addEventListener(Event.OPEN,comeco);
      loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progresso);
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completo);
      palco.addChild(loader); 
    function comeco(event:Event):void
              preloaderBar.visible = true;
              preloaderBar.barra.scaleX = 0;
    function progresso(e:ProgressEvent):void
              var perc:Number = e.bytesLoaded / e.bytesTotal;
              preloaderBar.percent.text = Math.ceil(perc*100).toString();
              preloaderBar.barra.scaleX =  perc;
    function completo(e:Event):void
              preloaderBar.percent.text = '';
              preloaderBar.visible = false;
    btHome.addEventListener(MouseEvent.MOUSE_DOWN,onHomeDown);
    btHome.addEventListener(MouseEvent.MOUSE_UP,onHomeUp);
    btSets.addEventListener(MouseEvent.MOUSE_DOWN,onSetsDown);
    btSets.addEventListener(MouseEvent.MOUSE_UP,onSetsUp);
    btVivo.addEventListener(MouseEvent.MOUSE_DOWN,onVivoDown);
    btVivo.addEventListener(MouseEvent.MOUSE_UP,onVivoUp);
    btHome.addEventListener(MouseEvent.CLICK,onHomeClick);
    btSets.addEventListener(MouseEvent.CLICK,onSetsClick);
    function onSetsClick(Event : MouseEvent) : void
              if (filme != "sets.swf")
                          filme = "sets.swf";
                          carregaFilme("sets.swf");
    function onHomeClick(Event : MouseEvent) : void
              if (filme != "home.swf")
                          filme = "home.swf";
                          carregaFilme("home.swf");
    function onHomeDown(Event : MouseEvent) : void
              btHome.y += 1;
    function onHomeUp(Event : MouseEvent) : void
              btHome.y -= 1;
    function onSetsDown(Event : MouseEvent) : void
              btSets.y += 1;
    function onSetsUp(Event : MouseEvent) : void
              btSets.y -= 1;
    function onVivoDown(Event : MouseEvent) : void
              btVivo.y += 1;
    function onVivoUp(Event : MouseEvent) : void
              btVivo.y -= 1;
    Now this is the sets.fla file:
    Here is the code for sets.fla
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    var video:Video;
    var nc:NetConnection;
    var ns:NetStream;
    var t : Timer = new Timer(1000,0);
    var meta:Object = new Object();
    this.addEventListener(Event.ADDED_TO_STAGE,init);
    function init(e:Event):void{
    video= new Video(320, 240);
    addChild(video);
    video.x = 80;
    video.y = 100;
    nc= new NetConnection();
    nc.connect(null);
    ns = new NetStream(nc);
    ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
    ns.bufferTime = 1;
    ns.client = meta;
    video.attachNetStream(ns);
    ns.play("http://www.djchambinho.com/videos/segundaquinta.flv");
    ns.pause();
    t.addEventListener(TimerEvent.TIMER,timeHandler);
    t.start();
    function onStatusEvent(stat:Object):void
              trace(stat.info.code);
    meta.onMetaData = function(meta:Object)
              trace(meta.duration);
    function timeHandler(event : TimerEvent) : void
      if (ns.bytesLoaded>0&&ns.bytesLoaded == ns.bytesTotal )
                ns.resume();
                t.removeEventListener(TimerEvent.TIMER,timeHandler);
                t.stop();
    The problem is when I test it on my computer it works but when I upload it to my phone it freezes when I click Sets Anteriores button.
    Please help me with this problem I dont know what else to do.
    thank you

    My first guess is you're simply generating an error. You'll always want to load this on your device in quick debugging over USB so you can see any errors you're generating.
    Outside that, if you plan on accessing anything inside the SWF you should be loading the SWF into the correct context. Relevant sample code:
    var context:LoaderContext = new LoaderContext();
    context.securityDomain = SecurityDomain.currentDomain;
    context.applicationDomain = ApplicationDomain.currentDomain;
    var urlReq:URLRequest = new URLRequest("http://www.[your_domain_here].com/library.swf");
    var ldr:Loader = new Loader();
    ldr.load(urlReq, context);
    More information:
    http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7de0.html
    If you're doing this on iOS you'll need to stripped SWFs if you plan on using any coding (ABC) inside the files. You mentioned iOS so I won't get into that here, but just incase, here's info on stripping external SWFs:
    http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air- apps-on-ios/

  • HELP!!! Problems in using PostgreSQL in jdk1.4.2

    Hi,
    Can anybody help me with my problem. i am using jdk1.4.2 and have a database connection with PostgreSQL Driver. I have connection to the Driver using the following code.
    Class.forName("org.postgresql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:postgresql:SchoolA","janeve.george","l0ngl1veme");
    Statement stmt = conn.createStatement();
    But an exception is thrown when the code in bold is executed. The exception is as follows:
    Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoint
    at org.postgresql.Driver.makeConnection(Driver.java:382)
    at org.postgresql.Driver.connect(Driver.java:260)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Sample.main(Sample.java:7)
    But when i go to java profile i get the following:
    D:\Personals\Java Programs>javap java.sql.Savepoint
    Compiled from null
    interface java.sql.Savepoint{
    public abstract int getSavepointId();
    throws java/sql/SQLException
    public abstract java.lang.String getSavepointName();
    throws java/sql/SQLException
    I have downloaded Driver for PostgreSQL for jdk1.4 but still there is this problem.
    There is no problem when i use the jdbc:odbc Bridge for any other Database. Please Solve this problem of mine.
    Regards,
    Janeve

    http://forum.java.sun.com/thread.jspa?threadID=735750&messageID=4227871

  • Urgent!!!! please help!!! problems with visual j++ and jbuilder

    Hi,
    I have been worried about this problem since a long time. I couldn't get any help figuring out the problem. I am using microsoft visual j++ 6.0
    I have tried putting the rt.jar file in the class path but its getting me out of the compilation errors and not this runtime error.
    I faced this problem with many codes.
    When i used the jbuilder as one of the users suggested, i am getting this compilation errors,
    "FloatingAgent.java": Error #: 704 : cannot access directory vrml at line 4, column 4
    "FloatingAgent.java": Error #: 704 : cannot access directory vrml\node at line 5, column 4
    "FloatingAgent.java": Error #: 704 : cannot access directory vrml\field at line 6, column 4
    "FloatingAgent.java": Error #: 300 : class Script not found in class FloatingAgent at line 9, column 39
    Please somebody help.
    Jagadish.
    // an agent is floating randomly.
    import java.util.*;
    import vrml.*;
    import vrml.node.*;
    import vrml.field.*;
    import java.io.*;
    public class FloatingAgent extends Script{
    SFVec3f setAgentPosition;
    SFRotation setAgentRosition;
         static int count=0;
         float agentPosition[] = new float[3];
         float agentRosition[] = new float[4];
         float rotangle = 0.0f;
         float aRad= (float) (Math.PI/180);
    //Random randomNumGenerator = new Random();
    public void initialize(){
    // get the reference of the event-out 'setAgentPosition'.
    setAgentPosition =
    (SFVec3f)getEventOut("setAgentPosition");
              setAgentRosition =
    (SFRotation)getEventOut("setAgentRosition");
    // initialize the agent position.
    agentPosition[0] = 0.0f;
    agentPosition[1] = 0.0f;
    agentPosition[2] = 0.0f;
         agentRosition[0] = 0.0f;
    agentRosition[1] = 0.0f;
    agentRosition[2] = 1.0f;
         agentRosition[3] = 0.0f;
    public void processEvent(Event e){
    if(e.getName().equals("interval") == true){
    moveAgent();
    // generate random float value ranging between -0.1 to 0.1.
    /*float generateRandomFloat(){
    return(randomNumGenerator.nextFloat() * 0.2f - 0.1f);
    // move the agent randomly.
    void moveAgent()
    agentPosition = reader();
    // agentPosition[0] += generateRandomFloat() ;
    // agentPosition[1] += generateRandomFloat();
    //agentPosition[2] += generateRandomFloat();
         rotangle += 2.0f;
         agentRosition[3] = rotangle * aRad;
    // move the agent to the new position.
    setAgentPosition.setValue(agentPosition);
         setAgentRosition.setValue(agentRosition);
    }//move agent
    static float[] reader()
         float p1[] = new float[3];
         try{
         FileReader fr = new FileReader("data.txt");
         BufferedReader br = new BufferedReader(fr);
         String s;
    int count1=0;
    count++;     
         try{  
         while((s=br.readLine())!=null)
    count1++;
              StringTokenizer st = new StringTokenizer(s);
              if(count1==count)
              int i=0;
              while(st.hasMoreTokens())
              p1[i++]=Float.parseFloat(st.nextToken());
              }//if
              }//end of stringTokenizer while.
         fr.close();                
         catch(IOException f)
              System.out.println("file cannot be opened");
         }//try
         catch(FileNotFoundException e)
         System.out.println("file doesn't exist");
         } //try
         return p1;
    }//reader

    Didn't we hear this from you yesterday? Sounds too familiar. If so, we told you you're using a MICROSOFT product (Visual J++), which is OLD, and not up to the SUN's java specification. We suggested that you dump Visual J++ and go with something like JBuilder, Forte, Visual Cafe, etc.
    This is a SUN site in support of SUN's java - not Microsoft's outdated and non-existent (anymore) version.

  • Every time apple sends an update for my Itunes it goes wrong. last time this happened I got someone to fix it for me. I am very techno phobic and do not understand the on line instructions for uninstalling and reenstalling.Please help in simple English.

    when ever Apple sends an update to my pc, it knackers up my itunes. The last time this happened I got someone to fix the problem for me, I am very techno phobic and do not understand the uninstalling and reinstalling. It comes up error MSVCR80. Please can someone help in simple English , as the technical jargon just goes over my head.
    much Thanks

    The last time this happened I got someone to fix the problem for me, I am very techno phobic and do not understand the uninstalling and reinstalling.
    I think you should get a friend or family member who knows a bit more about computers to fix this for you.
    They should try the following instructions.
    Uninstall your existing copy of iTunes. Delete any copies of the iTunesSetup.exe (or iTunes64Setup.exe) installer files from your downloads areas for your web browsers and download a fresh copy of the iTunes installer from the Apple website:
    http://www.apple.com/itunes/download/
    (The current build of the 11.1.4.62 installer was changed a few days ago, which fixed the bulk of the reports of MSVCR80.dll/R6034/APSDaemon.exe/Error-7/AMDS-could-not-start trouble ... but the build number on the installer was not changed. So we're trying to make sure you do the reinstall using a "new good" 11.1.4.62 installer instead of an "old bad".)
    Does the install with the new copy of the installer go through properly? If so, does that clear up the error message?
    If you still have the same error messages cropping up, then try the procedures from the following user tip:
    Troubleshooting issues with iTunes for Windows updates

Maybe you are looking for

  • Data filter using receiver determination/Interface determination

    Hi Friends, i have a scenario, which I need to filter the data based on one field that is "Amount field". the source data I am getting as flat file(.txt), The field values is 12 digit(e.g.. 000000000000,009999090000,945884949484). I wanted to filter

  • New to Mac, I need baby steps for importing vr format video

    I have read comments about streamclip and MPEG 2 playback, but I still can't seem to get going with my home video transfers. Every time I try to open a mini dvd, whatever program I am trying to use shuts down. I'm computer challenged and need all the

  • How to read MS Word file

    Hi, How can i read MS word file in java ? My problem is that want to read .doc file and convert this .doc file into .txt tile . I was try with Jakarata POI , but i m not found out POI ? How to use Jakarata POI for reading .doc file ? Thanks in advanc

  • SQL server 2012 - Database Availability Group

    We have 2 new Servers ready to be deployed as Database Servers for Sharepoint 2013. both server have 1TB RAID 5 Hard Disk Space. We don't have any kind of Shared Storage/SAN etc & we cannot afford to buy this. I have Configured Windows Server Fail-ov

  • Kt3 ultra2-r and xp2600 problem

    I have a msi kt3 ultra2-aru, and I have an amd xp2600. I have updated my bios to the A6380VMS.560 version because this one should recognize my xp2600+ When I look at the msi site I see that I should set my fsb to 133 (c-type cpu) and my multiplier to