Javac compiler throws java.nio.BufferOverflowException!!Why?

An exception has occurred in the compiler (1.4.1). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.nio.BufferOverflowException
at java.nio.charset.CoderResult.throwException(CoderResult.java:259)
at java.lang.StringCoding$CharsetSD.decode(StringCoding.java:186)
at java.lang.StringCoding.decode(StringCoding.java:222)
at java.lang.StringCoding.decode(StringCoding.java:228)
at java.lang.String.<init>(String.java:383)
at java.lang.String.<init>(String.java:404)
at java.io.UnixFileSystem.list(Native Method)
at java.io.File.list(File.java:914)
at com.sun.tools.javac.v8.code.ClassReader.list(ClassReader.java:1224)
at com.sun.tools.javac.v8.code.ClassReader.listAll(ClassReader.java:1320)
at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1340)
at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1049)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:332)
at com.sun.tools.javac.v8.comp.Enter.visitTopLevel(Enter.java:467)
at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:390)
at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:442)
at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:456)
at com.sun.tools.javac.v8.comp.Enter.complete(Enter.java:588)
at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:574)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:334)
at com.sun.tools.javac.v8.Main.compile(Main.java:520)
at com.sun.tools.javac.Main.compile(Main.java:36)
at com.sun.tools.javac.Main.main(Main.java:27)

See this bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4949631

Similar Messages

  • Java.nio.BufferOverflowException on big Strings ( 87MB)

    Hi!
    When calling getBytes() on a big String the following exception is thrown:
    java.nio.BufferOverflowException
         at java.nio.charset.CoderResult.throwException(Unknown Source)
         at java.lang.StringCoding$CharsetSD.decode(Unknown Source)
         at java.lang.StringCoding.decode(Unknown Source)
         at java.lang.StringCoding.decode(Unknown Source)
         at java.lang.String.<init>(Unknown Source)
         at java.lang.String.<init>(Unknown Source)
         at com.db.janus.Janus.main(Janus.java:99)
    This happens as soon as the size of the String gets bigger than 92003848 bytes.
    I can reproduce it with the following code:
    String x = new String(new byte[92003848]); // --> OK
    String x = new String(new byte[92003849]); // --> Exception
    JDK Version: 1.4.2_06
    OS: Windows XP
    Is this a known bug / limitation? I found a similar bug related to Java on Linux / Solaris, but this one was about getBytes() with Strings > 16MB.
    Thanks for your help!

    Is there any alternative to solve this problem.I am getting the error
    java.nio.BufferOverflowException .This happens in my mail server when the file six\ze of xml where i have stored data about spam/nonspam grows upto 22mb.I have stored this xml in database as blob.at server startup uploading in in my class.Keeps througout in JVM after every 50 th request saving information back to database(about spam/nonspam).Now if xml size grows i am storing this in string to parse etc.it gives this bug error.Sholud i cahnge my datatype or use something as XML Parser to split my xml in pieces(mechanism i am not aware of at all) so that string just takes some size of xml (but here can i use string builder etc.). Now is there any proper solution to this kind of problem whenever i removes some daya from xml spam mail goes to inbox and vice versa.
    Please suggest me some solution if possible.
    complete error is:
    Servlet initialization failed:
    java.nio.BufferOverflowException
    at java.nio.charset.CoderResult.throwException(CoderResult.java:259)
    at java.lang.StringCoding$CharsetSD.decode([BII)[C(Unknown Source)
             at java.lang.StringCoding.decode(Ljava.lang.String;[BII)[C(Unknown Source)
             at java.lang.String.<init>([BIILjava.lang.String;)V(Unknown Source)
             at java.lang.String.<init>([BLjava.lang.String;)V(Unknown Source)
             at zerocode.core.ByteBlock.toString(ByteBlock.java:89)
             at zcCollab.mailProcessing.NaiveBayesClassifier._getInstanceData(NaiveBayesClassifier.java:275)
             at zcCollab.mailProcessing.NaiveBayesClassifier.initialize(NaiveBayesClassifier.java:86)
             at zcCollab.mailProcessing.SimpleDeliveryManager._setupClassifiers(SimpleDeliveryManager.java:409)
             at zcCollab.mailProcessing.SimpleDeliveryManager.<init>(SimpleDeliveryManager.java:62)
             at zcCollab.zcApp.InfoManagerApp._createDeliveryProcessor(InfoManagerApp.java:307)
             at zcCollab.zcApp.InfoManagerApp.initialize(InfoManagerApp.java:294)
             at zerocode.udm.Application._createInstance(Application.java:168)
             at zerocode.udm.Application.createInstanceForServlet(Application.java:111)
             at zerocode.servlet.UdmServlet._createApplication(UdmServlet.java:67)
             at zerocode.servlet.UdmServlet._initialize(UdmServlet.java:52)
             at zerocode.servlet.GenericServlet.init(GenericServlet.java:116)
             at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:292)
             at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:329)
             at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:657)
             at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
             at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
             at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
             at org.mortbay.http.HttpServer.service(HttpServer.java:879)
             at org.mortbay.http.handler.ForwardHandler.handle(ForwardHandler.java:130)
             at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
             at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
             at org.mortbay.http.HttpServer.service(HttpServer.java:879)
    Thanks
    Vijendra                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • String.getBytes() & String(byte[]) - java.nio.BufferOverflowException

    The application in question uses JNI for legacy integration and I suspect the legacy code is corrupting the stack causing the above error. However, the error does not occur in Java 1.3, only Java 1.4.
    Is there some way to suppress 1.4's use of the native IO API when encoding and decoding byte streams? This would at least provide a workaround in the meantime.
    Thanks.

    This is beginning to make a little sense. The problem is that you got a String and you don't want one. A String wraps an array of chars, which your app needs, right? Specifically they're chars because you need 16-bit char sets.
    Presumably the getBytes() method call is used to get an array of bytes for some data transfer operation. java.nio was probably added in 1.4 as it has some very efficient ways of handling buffers as simultaneously of two or more types. It's trying to use the underlying char array as a byte array and there's a straight up bug someplace.
    Workaround is strange to contemplate, but I'm pretty sure it will work: use String.getChars() to get an array of chars, and then use java.nio yourself to create your byte array! If you've never been there, it's not very hard. I use nio all the time and it's never been a problem.

  • Oracle JDBC driver throwing java.nio.BufferUnderflowException exception

    Hi,
    We have a an application for which the middleware(SAR file) is running on Jboss.
    We have configured a DCN (data change notification) listener (As part of SAR file) to listen for the databases changes on port 56090.
    A weekly machine security scan has been scheduled. As part of the system scan, it scans the port 56090. Following exception has been thrown by the JDBC driver at the time of scanning.
    2009-05-24 16:29:37,874 INFO [STDOUT] java.nio.BufferUnderflowException
    2009-05-24 16:29:37,874 INFO [STDOUT] at java.nio.Buffer.nextGetIndex(Buffer.java:398)
    2009-05-24 16:29:37,874 INFO [STDOUT] at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:117)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.readByte(NTFConnection.java:616)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.readInt(NTFConnection.java:650)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.unmarshalNSDataPacket(NTFConnection.java:498)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.unmarshalOneNSPacket(NTFConnection.java:404)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.run(NTFConnection.java:181)
    And during scanning time very high CPU usage (90%) is encountered. Normal CPU usage of the application server system will be around 20%.
    Can you please give any information on the event/data which is causing the above exception. and how it can be handled, so as to minimize CPU usage back to 20%?
    Please give more information about oracle.jdbc.driver.NTFConnection class.
    Thanks in Advance
    Abdur Rahman
    Edited by: user11269361 on Jun 15, 2009 8:57 AM

    Hi,
    The DCN protocol is synchronous so if the security system scan sends a byte to the port 56090 the protocol will break. I recommend you configure the system scan to not interfere with DCN.
    Regards,
    Jean

  • Code compiles - throws java.lang.NullPointerException

    This program is intended to build an array and populate it with inventory, then print out the inventory line item by line item. The code compiles but throws the NullPointerException error when the program is run. Here is the main method with 2 classes, as well as the text from the error and a pointer to the specific place in the code the error is from...
    main method
    import java.util.Scanner;
    import static java.lang.System.out;
    import java.io.*;
    public class Inventory1
        private static void Exit() //set ability for program to exit on each loop
        { out.println("We hope this inventory program was " +
                           "helpful. Thank you for using our program.");
          System.exit(0);
      public static void main (String [] args)
          boolean validNumber;
          boolean validCount;
          boolean validDollars;
          //initialize scanner
      Scanner sc = new Scanner(System.in);        
      Music info = new Music();
      //declare and initialize variables
      int[] itemNumber = new int [5];
      String[] productName = new String[5];
      int[] stockAmount = new int[5];
      double[] productCost = new double[5];
      double[] totalValue = new double[5];
      while (true)
          for (int i=0; i<5; i++)
            out.println( "Enter CD name/description or 'exit' to stop the" +
                    " program: "); //prompt - product name
               info.productName[i] = sc.next(); // input
               if (info.productName.equalsIgnoreCase("exit"))
    out.println("Exit entered. ");
    Exit();
    else
    do
    out.println("Please enter CD number: "); //prompt - item number
    info.itemNumber[i] = sc.nextInt();
    validNumber = true;
    if( (info.itemNumber[i] <1 ) )
    {//make sure product number is positive number
    validNumber = false;
    out.println("All CDs have positive numbers and no other " +
    "characters. Please enter a valid CD number.");
    }while (!validNumber);
    do
    out.println("Quantity in stock: "); // prompt - quantity
    info.stockAmount [i] = (sc.nextInt()); // capture temp number to verify
    validCount = true;
    if(( info.stockAmount[i] <1 ))
    { // ensure stock amount is positive number
    validCount = false;
    out.println( "Inventory numbers must be positive. Please " +
    "enter a correct value." ); // prompt for correct #
    } while (!validCount);
    do
    out.println("What is the product cost for each unit? "); // prompt - cost
    info.productCost[i] = sc.nextDouble();
    validDollars = true;
    if (( info.productCost[i] <1 ))
    validDollars = false;
    out.println( "Product cost must be a positive dollar " +
    "amount. Please enter correct product cost." );
    } while (!validDollars);
    out.println(totalValue);
    @Override
    public String toString()
    return super.toString();
    Music classclass Music
    String productName[];
    String title;
    int itemNumber[];
    int item;
    int stockAmount[];
    int amount;
    double productCost[];
    double cost;
    double totalValue[];
    double value;
    int i;
    public Music(String title, int item, int amount, double cost, double value,
    int i)
    this.productName[i] = title;
    this.itemNumber[i] = item;
    this.stockAmount[i] = amount;
    this.productCost[i] = cost;
    this.totalValue[i] = value;
    public Music()
    public void setTotalValue(double[] totalValue)
    this.totalValue = totalValue;
    public double[] getTotalValue()
    return totalValue;
    public void setStockAmount(int[] stockAmount)
    this.stockAmount = stockAmount;
    public int[] getStockAmount()
    return stockAmount;
    public void setProductCost(double[] productCost)
    this.productCost = productCost;
    public double[] getProductCost()
    return productCost;
    public void setProductName(String[] productName)
    this.productName = productName;
    public String[] getProductName()
    return productName;
    public void setItemNumber (int[] itemNumber)
    this.itemNumber = itemNumber;
    public int[] getItemNumber()
    return itemNumber;
    }TotalInventory classclass TotalInventory
    double TotalInfo;
    public int [] getStockAmount(int[] units)
    int[] stockAmount = units;
    return units;
    public double[] getTotalValue(double[] cost)
    double[] productCost = cost;
    return cost;
    error message
    init:
    deps-jar:
    Compiling 1 source file to C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\build\classes
    compile:
    run:
    Enter CD name/description or 'exit' to stop the program:
    here we go
    Exception in thread "main" java.lang.NullPointerException
            at Inventory1.main(Inventory1.java:54)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 4 seconds)
    Inventory1.main(Inventory1.java:54) is this line of code in the main method: info.productName[i] = sc.next(); // input Any suggestions?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I have not changed my code from when I supplied it in the first post - I am simply pointing out that I already initiated the String with 5 as the number...I've supplied you with everything I am getting. The three modules are in the original post, as is the error message being received - nothing has changed.
    This means with the code posted in my original question I am getting an NPE. I compile the code and run it. I'm able to input the "title" (productName) after the prompt but then get the NPE. I'm not trying to make you read my mind, I'm just asking for help and make every effort to provide as much detail as possible to make that easier on all of us.

  • Why i am unable to compile this .java

    Hi
    I get the Error messages
    C:\kk>javac BICDownloader.java
    BICDownloader.java:61: cannot find symbol
    symbol : method openConnection()
    location: class java.lang.String
    URLConnection urlc = url.openConnection();
    ^
    BICDownloader.java:64: cannot find symbol
    symbol : class SSLTunnelSocketFactory
    location: class BICDownloader
    (new SSLTunnelSocketFactory(proxyHost,proxyPort));
    ^
    Note: BICDownloader.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    2 errors
    When trying to compile
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.FileOutputStream;
    import java.io.FileInputStream;
    import java.util.StringTokenizer;
    import java.util.Properties;
    import java.net.*;
    import java.io.*;
    import java.security.*;
    import javax.net.*;
    import javax.net.ssl.*;
    import javax.net.SocketFactory;
    import javax.net.ssl.SSLSocketFactory;
    import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
    import org.apache.commons.httpclient.HttpClient;
    import org.apache.commons.httpclient.Header;
    import org.apache.commons.httpclient.HttpException;
    import org.apache.commons.httpclient.HttpStatus;
    import org.apache.commons.httpclient.methods.GetMethod;
    import org.apache.commons.httpclient.params.HttpMethodParams;
    import org.apache.commons.httpclient.UsernamePasswordCredentials;
    import org.apache.commons.httpclient.auth.AuthScope;
    * Created on Mar 2, 2007
    * S.W.I.F.T. s.c.r.l.
    public class BICDownloader {
    private final static String proxyHost = "isln616";
    private final static String proxyPort = "9090";
         public static void main(String[] args) throws Exception {
              int exitcode = 0;
              int statusCode;
       String url = "https://www2.swift.com/bicdownload/bicdownloader?"
                              + "action=getfile&productline=bicdir&product=bicdb&content=delta&format=txt";
    HttpClient client = new HttpClient();
             GetMethod method = new GetMethod(url);
             // Provide custom retry handler if required
             method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
                                              new DefaultHttpMethodRetryHandler(3, false));
         System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
          //System.setProperty("https.proxyHost",proxyHost);
          //System.setProperty("https.proxyPort",proxyPort);
                   URLConnection urlc = url.openConnection();
          if(urlc instanceof com.sun.net.ssl.HttpsURLConnection){
                        ((com.sun.net.ssl.HttpsURLConnection)urlc).setSSLSocketFactory
                             (new SSLTunnelSocketFactory(proxyHost,proxyPort));
             try {
                  // We strongly recommend obfuscation of password  and restricted access to its storage
                  Properties prop = new Properties();
                  InputStream fis = (InputStream)new FileInputStream("c:/KK/bicdownload.prop");
                  prop.load(fis);
                  // Set Credentials
                  UsernamePasswordCredentials credentials;
                  credentials = new UsernamePasswordCredentials(prop.getProperty("username"),
                                                                  prop.getProperty("password"));
                  client.getState().setCredentials(new AuthScope("www2.swift.com", 443), credentials);
                  // Executing the method.
                  statusCode = client.executeMethod(method);
                  if (statusCode != HttpStatus.SC_OK) {
                       // Handling HTTP error 404 and 500 not covered in this example
                       // All http error cause in this example exit with status 1.
                       System.err.println("Method failed: " + method.getStatusLine()+ "\n" +
                                         method.getResponseBodyAsString());
                       System.out.println(method.getRequestCharSet() + "\n" + method.getRequestHeader("").toString());
                       exitcode = 1;
                  else {
                       //Get the file size from the response body and do something with it
                       Header[] contlen = method.getResponseHeaders("Content-Length");
                       if (contlen.length != 0) {
                            StringTokenizer stone = new StringTokenizer(contlen[0].getValue(), "=");
                            int size = new Integer(stone.nextToken()).intValue();
                            // Do something with the file size
                            System.out.println("File size is: " + size);
                       // Get the filename from the response body.
                       InputStream is = method.getResponseBodyAsStream();
                       Header[] contdisp = method.getResponseHeaders("Content-Disposition");
                       String filename = null;
                       StringTokenizer sttwo = new StringTokenizer(contdisp[0].getValue(), "=");
                       while (sttwo.hasMoreTokens()) filename = sttwo.nextToken();
                       // Hardcoded disk and directory path are indicative
                       FileOutputStream fos = new FileOutputStream("c:/kk/" + filename);
                       byte[] buffer = new byte[4096];
                       int count = is.read(buffer);
                       while (count != -1) {
                            fos.write(buffer, 0, count);
                            count = is.read(buffer);
                       fos.flush();
                       fos.close();
                       is.close();
             } catch (HttpException e) {
                  exitcode = 2;
                  System.err.println("Fatal HTTP Error: " + e.getMessage());
                  e.printStackTrace();
             } catch (IOException e) {
                  exitcode = 3;
                  System.err.println("Fatal I/O error: " + e.getMessage());
                  e.printStackTrace();
             } finally {
                  // Release the connection.
                  method.releaseConnection();
                  System.exit(exitcode);
             System.out.println("Dowload done");
    }

    Look at the Classnames it's complaining about, then look at your import list.
    That is the reason, of course.
    Edit: The second error has to do with the Classes. The first one, is as pointed out below,
    is because how you declared and defined your "url" variable, which should be URL and not String.

  • Javac: compiling java file only if necessary

    hello,
    i have the problem that i want to compile a java file only if there are any changes...i don't want to use any other "tools" than the compiler (javac) but no third party apps...is there a solution for my problem...perhaps with a little shell script? or is there an easier solution? thx for replies

    You can write a shell script for this, assuming you're using a decent shell and you have reasonable standard unix utils on your system. Do a "man test".
    But you should just use make or Ant or the like.

  • Why my cutomize role mapper throws java.lang.ClassCastException: $Proxy67

    Hello all,
    I customize the role mapper as follows is my MDF content
    &lt;MBeanType
    Name = "TestRoleMapper"
    DisplayName = "TestRoleMapper"
    Package = "test.pkg.roles"
    Extends = "weblogic.management.security.authorization.RoleMapper"
    Implements = "weblogic.management.security.authorization.RoleReader"
    PersistPolicy = "OnUpdate"
    I implements the method "listRolesForResource", this method declared to return a string array.
    When I return the role name array then Weblogic throws java.lang.ClassCastException: $Proxy67
    Error snapshot
    http://antonov0318.googlepages.com/error.jpg
    Would I miss some interface ?
    Would somebody know how to solve it?
    Please let me know , Please....Thank you very much.
    Edited by: user6273860 on 2008/10/25 上午 12:00

    It looks like you're just taking random methods,
    calling them incorrectly, and expecting them to
    work.
    What do you think this will do?
         * Construct {@link java.lang.Object} array of keys from {@link java.util.Hashtable}
         * @param h {@link java.util.Hashtable}
         * @return array {@link java.lang.String}
         * @throws java.lang.IndexOutOfBoundsException Exception thrown if initial {@link java.lang.Object} array paramater cannot be indexed
        public static Object[] arrayKeys(Hashtable<Object, Object> h) throws IndexOutOfBoundsException {
            return h.keySet().toArray();
        }>
    ArrayFunctionality.arrayKeys(attrs)(new
    String[attrs.size()]);What's arrayKeys? And what do you think
    method(args) (some other stuff) ; will
    do?
    Somebody else showed you what to do earlier, but they
    had a typo. You need to pass an array of the
    appropriate type to toArray:
    String[] stringArr =
    (String[])theList.toArray(someStringArray);Read the docs for that method so you understand how
    it works. Just just blindly copy/paste.The API docs for toArray() for java.util.Set interface takes no parameters, I can't expect to know you can override it

  • How to use java.nio on Mac?

    I am getting the error "cannot find symbol" on "Path", "FIles", etc. I am using javac and java 1.8.0_20 on Mac OS X 10.9.2 and the Terminal. Thanks.
    import java.io.*;
    import java.nio.*;
    class a{
         public static void main(String args[]) throws IOException{
              Path directorio = "/Users/Josue/Desktop/";
              try {
                   DirectoryStream<Path> stream = Files.newDirectoryStream(dir);
                   for( Path file: stream ){
                        System.out.println(file.getFileName());
              catch ( DirectoryIteratorException x ){
                   System.err.println(x);

    Before you answer, I got the solution (from somewhere else), it was because I didn't import explicitly the  classes Files, Paths, etc.
    But I don't understand why  .*  didn't work to do it?

  • Java.nio select() method return 0 in my client application

    Hello,
    I'm developing a simple chat application who echo messages
    But my client application loop because the select() method return 0
    This is my code
    // SERVER
    package test;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.ServerSocketChannel;
    import java.nio.channels.SocketChannel;
    import java.util.Iterator;
    import java.util.Set;
    public class Server {
         private int port = 5001;
         public void work() {               
              try {
                   ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
                   serverSocketChannel.configureBlocking(false);
                   InetSocketAddress isa = new InetSocketAddress(port);               
                   serverSocketChannel.socket().bind(isa);
                   Selector selector = Selector.open();
                   serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);
                   System.out.println("Listing on "+port);
                   while(selector.select()>0) {
                        Set keys = selector.selectedKeys();
                        for(Iterator i = keys.iterator(); i.hasNext();) {
                             SelectionKey key = (SelectionKey) i.next();
                             i.remove();
                             if (key.isAcceptable()) {
                                  ServerSocketChannel keyChannel = (ServerSocketChannel)key.channel();                              
                                  SocketChannel channel = keyChannel.accept();
                                  channel.configureBlocking(false);                              
                                  channel.register(selector, SelectionKey.OP_READ );
                             } else if (key.isReadable()) {
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  String m = Help.read(keyChannel );
                                  Help.write(m.toUpperCase(), keyChannel );
              } catch (IOException e) {                                             
                   e.printStackTrace();                         
         public static void main(String[] args) {
              Server s = new Server();
              s.work();
    // CLIENT
    package test;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.SocketChannel;
    import java.util.Iterator;
    import java.util.Set;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    public class Client extends JFrame  {
         private String host = "localhost";
         private int port = 5001;
         private SocketChannel socketChannel;
         private Selector selector;
         public void work() {               
              try {
                   socketChannel = SocketChannel.open();
                   socketChannel.configureBlocking(false);
                   InetSocketAddress isa = new InetSocketAddress(host, port);               
                   socketChannel.connect(isa);
                   selector = Selector.open();
                   socketChannel.register(selector, SelectionKey.OP_CONNECT | SelectionKey.OP_READ );
                   while(true) {
                        selector.select();
                        Set keys = selector.selectedKeys();
                        for(Iterator i = keys.iterator(); i.hasNext();) {
                             SelectionKey key = (SelectionKey) i.next();
                             i.remove();
                             if (key.isConnectable()) {
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  if (keyChannel.isConnectionPending()) {
                                       System.out.println("Connected "+keyChannel.finishConnect());                                                                           
                             } else if (key.isReadable()) {                                                                                                                                                           
                                  SocketChannel keyChannel = (SocketChannel) key.channel();                                             
                                  String m = Help.read(keyChannel);
                                  display(m);                                                                                                                                                                                                                   
              } catch (IOException e) {                                             
                   e.printStackTrace();                         
         private void display(final String m) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        area.append(m+"\n");
                        textFieed.setText("");
         private void sendMessage(final String m) {
              Thread t = new Thread(new Runnable() {               
                   public void run() {                                                                                
                        try {                         
                             Help.write(m, socketChannel);
                        } catch (IOException e) {               
                             e.printStackTrace();
              t.start();                    
         public Client() {
              addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(1);
              textFieed.addKeyListener(new KeyAdapter() {
                   public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode()== KeyEvent.VK_ENTER) {
                             String m = textFieed.getText();
                             sendMessage(m);     
              area.setEditable(false);
              getContentPane().add(textFieed, "North");
              getContentPane().add(new JScrollPane(area));
              setBounds(200, 200, 400, 300);
              show();
         private String messageToSend;
         private JTextArea area = new JTextArea();
         JTextField textFieed = new JTextField();
         public static void main(String[] args) {
              Client s = new Client();
              s.work();
    // HELPER CLASS
    package test;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    import java.nio.CharBuffer;
    import java.nio.channels.SocketChannel;
    import java.nio.charset.Charset;
    import java.nio.charset.CharsetDecoder;
    import java.nio.charset.CharsetEncoder;
    public class Help {
         private static Charset charset = Charset.forName("us-ascii");
         private static CharsetEncoder enc = charset.newEncoder();
         private static CharsetDecoder dec = charset.newDecoder();
         private static void log(String m) {
              System.out.println(m);
         public static String read(SocketChannel channel) throws IOException {
              log("*** start READ");                              
              int n;
              ByteBuffer buffer = ByteBuffer.allocate(1024);
              while((n = channel.read(buffer)) > 0) {
                   System.out.println("     adding "+n+" bytes");
              log("  BUFFER REMPLI : "+buffer);
              buffer.flip();               
              CharBuffer cb = dec.decode(buffer);          
              log("  CHARBUFFER : "+cb);
              String m = cb.toString();
              log("  MESSAGE : "+m);          
              log("*** end READ");
              //buffer.clear();
              return m;                    
         public static void write(String m, SocketChannel channel) throws IOException {          
              log("xxx start WRITE");          
              CharBuffer cb = CharBuffer.wrap(m);
              log("  CHARBUFFER : "+cb);          
              ByteBuffer  buffer = enc.encode(cb);
              log("  BUFFER ALLOUE REMPLI : "+buffer);
              int n;
              while(buffer.hasRemaining()) {
                   n = channel.write(buffer);                         
              System.out.println("  REMAINING : "+buffer.hasRemaining());
              log("xxx end WRITE");

    Here's the fix for that old problem. Change the work method to do the following
    - don't register interest in things that can't happen
    - when you connect register based on whether the connection is complete or pending.
    - add the OP_READ interest once the connection is complete.
    This doesn't fix all the other problems this code will have,
    eg.
    - what happens if a write is incomplete?
    - why does my code loop if I add OP_WRITE interest?
    - why does my interestOps or register method block?
    For code that answers all those questions see my obese post Taming the NIO Circus
    Here's the fixed up Client code
    // CLIENT
    package test
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.SocketChannel;
    import java.util.Iterator;
    import java.util.Set;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    public class Client extends JFrame  {
         private String host = "localhost";
         private int port = 5001;
         private SocketChannel socketChannel;
         private Selector selector;
         public void work() {
              try {
                   socketChannel = SocketChannel.open();
                   socketChannel.configureBlocking(false);
                   InetSocketAddress isa = new InetSocketAddress(host, port);
                   socketChannel.connect(isa);
                   selector = Selector.open();
                   int interest = 0;
                   if(socketChannel.isConnected())interest = SelectionKey.OP_READ;
                   else if(socketChannel.isConnectionPending())interest = SelectionKey.OP_CONNECT;
                   socketChannel.register(selector, interest);
                   while(true)
                        int nn = selector.select();
                        System.out.println("nn="+nn);
                        Set keys = selector.selectedKeys();
                        for(Iterator i = keys.iterator(); i.hasNext();)
                             SelectionKey key = (SelectionKey) i.next();
                             i.remove();
                             if (key.isConnectable())
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  System.out.println("Connected "+keyChannel.finishConnect());
                                  key.interestOps(SelectionKey.OP_READ);
                             if (key.isReadable())
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  String m = Help.read(keyChannel);
                                  display(m);
              } catch (IOException e) {
                   e.printStackTrace();
         private void display(final String m) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        area.append(m+"\n");
                        textFieed.setText("");
         private void sendMessage(final String m) {
              Thread t = new Thread(new Runnable() {
                   public void run() {
                        try {
                             Help.write(m, socketChannel);
                        } catch (IOException e) {
                             e.printStackTrace();
              t.start();
         public Client() {
              addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(1);
              textFieed.addKeyListener(new KeyAdapter() {
                   public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode()== KeyEvent.VK_ENTER) {
                             String m = textFieed.getText();
                             sendMessage(m);
              area.setEditable(false);
              getContentPane().add(textFieed, "North");
              getContentPane().add(new JScrollPane(area));
              setBounds(200, 200, 400, 300);
              show();
         private String messageToSend;
         private JTextArea area = new JTextArea();
         JTextField textFieed = new JTextField();
         public static void main(String[] args) {
              Client s = new Client();
              s.work();

  • Trying to compile a .java file from another .java file

    Hello,
    I'm trying to compile a .java file from another .java file using Runtime.exec...
    String c[]=new String[3];
    c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
    Process p=Runtime.exec(c);
    If anyone can help me in atleast getting the command prompt when Runtime.exec("cmd.exe") is executed...that would be great...I tried out notepad.exe, calc, explorer instead of cmd.exe...all the commands display their respective windows..except cmd.exe...the command prompt doesnt appear...
    Please help me ASAP....
    Thanks for your help in advance...
    Regards.
    AKhila.

    try this. ur code will be compliled and will get .class file. but console won't appear. is it a must for u?
    public class Exec{
         public static void main(String a[]) throws Exception{
              String c[]=new String[3];
              c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
              Process p=Runtime.getRuntime().exec(c);
              // or Runtime.getRuntime().exec("javac Hello.java");

  • Any java.nio guru out there ?

    Hi help,
    I'm studying new java.io classes. I've compiled and learnt
    a basic server like this...
    import java.io.*;
    import java.net.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.util.*;
    public class Server {
       private static int port = 9999;
       public static void main(String args[])
         throws Exception {
         Selector selector = Selector.open();
         ServerSocketChannel channel =
           ServerSocketChannel.open();
         channel.configureBlocking(false);
         InetSocketAddress isa = new InetSocketAddress(port);
         channel.socket().bind(isa);
         // Register interest in when connection
         channel.register(selector, SelectionKey.OP_ACCEPT);
         // Wait for something of interest to happen
         while (selector.select() > 0) {
           // Get set of ready objects
           Set readyKeys = selector.selectedKeys();
           Iterator readyItor = readyKeys.iterator();
           // Walk through set
           while (readyItor.hasNext()) {
             // Get key from set
             SelectionKey key =
               (SelectionKey)readyItor.next();
             // Remove current entry
             readyItor.remove();
             if (key.isAcceptable()) {
               // Get channel
               ServerSocketChannel keyChannel =
                 (ServerSocketChannel)key.channel();
               // Get server socket
               ServerSocket serverSocket = keyChannel.socket();
               // Accept request
               Socket socket = serverSocket.accept();
               // Return canned message
               PrintWriter out = new PrintWriter
                 (socket.getOutputStream(), true);
               out.println("Hello, NIO");
               out.close();
             } else {
               System.err.println("Ooops");
         // Never ends
    } now I'd like to write a Proxy Server. In other
    words the Server must
    1. listen for a request
    2. forward the request to another server
    3. listen its reply
    4. forward it back to the original caller.
    I've tried to modify the basic class but with no success....
    unfortunately I'm not that smart with these new Apis.
    anybody can give me some guidelines about how should I
    struct it ?
    Thanks a lot
    Francesco

    Not a guru but I'll offer some suggestions. Are these persistent connections to the proxy, or is a connection made per request? You'll probably do things a little bit differently in the two different cases.
    In general though, you can have one thread running a request dispatcher which accepts incoming connections and puts read ready channels on a queue. Another thread(or threads) can take requests off the queue and process them. Also, when you accept new connections, I think its better to do it through channels, rather than work directly with the socket. Something like this:
    SocketChannel clientChannel = serverChannel.accept();
    clientChannel.configureBlocking(false);
    SelectionKey newReadKey = clientChannel.register(selector, SelectionKey.OP_READ);
    Where are you getting into problems?

  • Compiling a .java at runtime

    hi,
    i have program that generates a java class and write's this class into a file.
    how can i compile this class to load it later in the program ?
    i would prefer a solution without writing the .java file ;-)
    Dirk

    yes, use com.sun.tools.javac.Main class. Usage is:
    com.sun.tools.javac.Main compiler = new com.sun.tools.javac.Main();
    int returnCode = compiler.compile("your_java_file");The method compile(String[] args) accept the same args as javac, and in fact, javac itself invoke a JVM and run com.sun.tools.javac.Main class (this may explain why javac is so slowly).
    Anyway, take a look at the com.sun.tools.javac package, you can find more. (say you'll find that the compiler is actually in the package com.sun.tools.javac.v8 package).

  • Using java.nio

    I have copied this, one program from a book that would have to read file of gives to me to you mixed but it does not work, you could me why?
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.nio.ByteBuffer;
    import java.nio.channels.FileChannel;
    public class ReadPrimesMixedData {
    public static void main(String[] args) {
    File aFile = new File("C:/Beg Java Stuff/primes.txt");
    FileInputStream inFile = null;
    try {
    inFile = new FileInputStream(aFile);
    } catch(FileNotFoundException e) {
    e.printStackTrace(System.err);
    System.exit(1);
    FileChannel inChannel = inFile.getChannel();
    try {
    ByteBuffer lengthBuf = ByteBuffer.allocate(8);
    int strLength = 0; // Stores the string length
    ByteBuffer buf = null; // Stores a reference to the second byte buffer
    byte[] strChars = null; // Stores a reference to an array to hold the string
    while(true) {
    if(inChannel.read(lengthBuf) == -1) // Read the string length, if its EOF
    break; // exit the loop
    lengthBuf.flip();
    strLength = (int)lengthBuf.getDouble(); // Extract the length and convert to int
    buf = ByteBuffer.allocate(strLength+8); // Buffer for the string & the prime
    if(inChannel.read(buf) == -1) {            // Read the string & binary prime value
    assert false; // Should not get here!
    break; // Exit loop on EOF
    buf.flip();
    strChars = new byte[strLength]; // Create the array for the string
    buf.get(strChars); // Extract string & binary prime value
    System.out.println("String length: " + strChars.length+ " String: " +
    new String(strChars) + " Binary value: " + buf.getLong());
    lengthBuf.clear(); // Clear the buffer for the next read
    System.out.println("\nEOF reached.");
    inFile.close(); // Close the file and the channel
    } catch(IOException e) {
    e.printStackTrace(System.err);
    System.exit(1);
    System.exit(0);
    This e' the program that writes the file
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.FileChannel;
    public class PrimesToFile2 {
    public static void main(String[] args) {
    int primesRequired = 100; // Default count
    if (args.length > 0) {
    try {
    primesRequired = Integer.valueOf(args[0]).intValue();
    } catch (NumberFormatException e) {
    System.out.println("Prime count value invalid. Using default of "
    + primesRequired);
    long[] primes = new long[primesRequired]; // Array to store primes
    primes[0] = 2; // Seed the first prime
    primes[1] = 3; // and the second
    // Count of primes found - up to now, which is also the array index
    int count = 2;
    long number = 5; // Next integer to be tested
    outer:
    for (; count < primesRequired; number += 2) {
    // The maximum divisor we need to try is square root of number
    long limit = (long) Math.ceil(Math.sqrt((double) number));
    // Divide by all the primes we have up to limit
    for (int i = 1; i < count && primes[i] <= limit; i++)
    if (number % primes[i] == 0) // Is it an exact divisor?
    continue outer; // yes, try the next number
    primes[count++] = number; // We got one!
    File aFile = new File("C:/Beg Java Stuff/primes.txt");
    FileOutputStream outputFile = null;
    try {
    outputFile = new FileOutputStream(aFile);
    } catch (FileNotFoundException e) {
    e.printStackTrace(System.err);
    System.exit(1);
    FileChannel file = outputFile.getChannel();
    final int BUFFERSIZE = 100; // Buffer size in bytes
    ByteBuffer buf = ByteBuffer.allocate(BUFFERSIZE);
    DoubleBuffer doubleBuf = buf.asDoubleBuffer();
    buf.position(8);
    CharBuffer charBuf = buf.asCharBuffer();
    LongBuffer longBuf = null;
    String primeStr = null;
    for (int i = 0; i < primes.length; i++) {
    primeStr = "prime = " + primes; // Create the string
    doubleBuf.put(0,(double) primeStr.length());// Store the string length
    charBuf.put(primeStr); // Store the string
    buf.position(2 * charBuf.position() + 8); // Position for 3rd buffer
    longBuf = buf.asLongBuffer(); // Create the buffer
    longBuf.put(primes[i]); // Store the binary long value
    buf.position(buf.position() + 8); // Set position after last value
    buf.flip(); // and flip
    try {
    file.write(buf); // Write the buffer as before.
    } catch (IOException e) {
    e.printStackTrace(System.err);
    System.exit(1);
    buf.clear();
    doubleBuf.clear();
    charBuf.clear();
    try {
    System.out.println("File written is " + file.size() + " bytes.");
    outputFile.close(); // Close the file and its channel
    } catch (IOException e) {
    e.printStackTrace(System.err);
    System.exit(1);
    System.exit(0);
    This works correctly

    I don't have problems when I compile the program but if I run the program ....I have this
    String length: 9 String: prim Binary value: 7277852183226228736
    String length: 0 String: Binary value: 162166969980682240
    String length: 0 String: Binary value: 7854388801345436928
    String length: 0 String: Binary value: 3573983215616
    Stjava.lang.IllegalArgumentException
    at java.nio.ByteBuffer.allocate(ByteBuffer.java:303)
    at ReadPrimesMixedData.main(ReadPrimesMixedData.java:35)
    ring length: 0 String: Binary value: 7566167222444367872
    String length: 0 String: Binary value: 88089088
    String length: 0 String: Binary value: 8214681170873443584
    String length: 0 String: Binary value: 1856
    String length: 0 String: Binary value: 8070575878335130880
    Exception in thread "main"

  • Unable to compile the Java Files generated by JAXB

    Hi,
    I have generated the Java Files for a DTD and .xjs file using JAXB. But when i tyr to compile the .java files generated i am getting errors.
    My DTD file is addctq.dtd
    <?xml version="1.0" encoding="UTF-8"?>
    <!ELEMENT AddCtq (Ctq*)>
    <!ELEMENT Ctq (PartNumber ,PartDescription,CtqDescription,CtqType,ProductLine,Supplier,Ppctq,Ctp,Ctc,CtqCode1,CtqCode2,CtqCode3,Commodity,SubCommodity,UnitOfMeasure,Client,SamplingFrequency,Remarks,VariableData)>
    <!ELEMENT VariableData (SubGroupSize, Specification,Nominal,Usl,Ual,Lal,Lsl,Zal,RangeVal?,RangeAlarmVal?)>
    <!ELEMENT PartNumber (#PCDATA)>
    <!ATTLIST PartNumber new CDATA #REQUIRED >
    <!ELEMENT PartDescription (#PCDATA)>
    <!ELEMENT CtqDescription (#PCDATA)>
    <!ELEMENT CtqType (#PCDATA)>
    <!ELEMENT ProductLine (#PCDATA)>
    <!ELEMENT Supplier (#PCDATA)>
    <!ELEMENT Ppctq (#PCDATA)>
    <!ELEMENT Ctp (#PCDATA)>
    <!ELEMENT Ctc (#PCDATA)>
    <!ELEMENT CtqCode1 (#PCDATA)>
    <!ELEMENT CtqCode2 (#PCDATA)>
    <!ELEMENT CtqCode3 (#PCDATA)>
    <!ELEMENT Commodity (#PCDATA)>
    <!ELEMENT SubCommodity (#PCDATA)>
    <!ELEMENT UnitOfMeasure (#PCDATA)>
    <!ELEMENT Client (#PCDATA)>
    <!ELEMENT SamplingFrequency (#PCDATA)>
    <!ELEMENT Remarks (#PCDATA)>
    <!ELEMENT SubGroupSize (#PCDATA)>
    <!ELEMENT Specification (#PCDATA)>
    <!ELEMENT Nominal (#PCDATA)>
    <!ELEMENT Usl (#PCDATA)>
    <!ELEMENT Ual (#PCDATA)>
    <!ELEMENT Lal (#PCDATA)>
    <!ELEMENT Lsl (#PCDATA)>
    <!ELEMENT Zal (#PCDATA)>
    <!ELEMENT RangeVal (#PCDATA)>
    <!ELEMENT RangeAlarmVal (#PCDATA)>
    and the .xjs file i created is addctq.xjs
    <?xml version="1.0" encoding="UTF-8" ?>
    <xml-java-binding-schema version="1.0-ea">
    <options package="com.geindustrial.sqms"/>
    <element name="AddCtq" type="class" root="true">
    <content>
    <element-ref name="Ctq"/>
    </content>
    </element>
    <element name="Ctq" type="class">
    <content>
         <element-ref name="PartNumber"/>
         <element-ref name="PartDescription"/>
         <element-ref name="CtqDescription"/>
         <element-ref name="CtqType"/>
         <element-ref name="ProductLine"/>
         <element-ref name="Supplier"/>
         <element-ref name="Ppctq"/>
         <element-ref name="Ctp"/>
         <element-ref name="Ctc"/>
         <element-ref name="CtqCode1"/>
         <element-ref name="CtqCode2"/>
         <element-ref name="CtqCode3"/>
         <element-ref name="Commodity"/>
         <element-ref name="SubCommodity"/>
         <element-ref name="UnitOfMeasure"/>
         <element-ref name="Client"/>
         <element-ref name="SamplingFrequency"/>
         <element-ref name="Remarks"/>
         <element-ref name="VariableData"/>
    </content>      
    </element>
    <element name="VariableData" type="class">
    <content>
    <element-ref name="SubGroupSize"/>
    <element-ref name="Specification"/>
    <element-ref name="Nominal"/>
    <element-ref name="Usl"/>
    <element-ref name="Ual"/>
    <element-ref name="Lal"/>
    <element-ref name="Lsl"/>
    <element-ref name="Zal"/>
    </content>
    </element>
    <element name="PartNumber" type="value">
    <attribute name="new"/>
    </element>
    <element name="PartDescription" type="value">
    </element>
    <element name="CtqDescription" type="value">
    </element>
    <element name="CtqType" type="value">
    </element>
    <element name="ProductLine" type="value">
    </element>
    <element name="Supplier" type="value">
    </element>
    <element name="Ppctq" type="value">
    </element>
    <element name="Ctp" type="value">
    </element>
    <element name="Ctc" type="value">
    </element>
    <element name="CtqCode1" type="value">
    </element>
    <element name="CtqCode2" type="value">
    </element>
    <element name="CtqCode3" type="value">
    </element>
    <element name="Commodity" type="value">
    </element>
    <element name="SubCommodity" type="value">
    </element>
    <element name="UnitOfMeasure" type="value">
    </element>
    <element name="Client" type="value">
    </element>
    <element name="SamplingFrequency" type="value">
    </element>
    <element name="Remarks" type="value">
    </element>
    <element name="SubGroupSize" type="value" convert="int">
    </element>
    <element name="Specification" type="value">
    </element>
    <element name="Nominal" type="value" convert="float">
    </element>
    <element name="Usl" type="value" convert="float">
    </element>
    <element name="Ual" type="value" convert="float">
    </element>
    <element name="Lal" type="value" convert="float">
    </element>
    <element name="Lsl" type="value" convert="float">
    </element>
    <element name="Zal" type="value" convert="float">
    </element>
    <element name="RangeVal" type="value" convert="float">
    </element>
    <element name="RangeAlarmVal" type="value" convert="float">
    </element>
    </xml-java-binding-schema>
    When i ran the xjc , it generated 3 .java files
    AddCtq.java , Ctq.java and VariableData.java
    But i am unable to compile any of the above files...
    The Error i am getting is
    VariableData.java:710: Undefined variable or class name: AddCtq
    return AddCtq.newDispatcher();
    ^
    1 error
    If i try to compile AddCtq.java , the Error i am getting is
    AddCtq.java:4: Class com.geindustrial.sqms.Ctq not found in import.
    import com.geindustrial.sqms.Ctq;
    ^
    AddCtq.java:169: Class com.geindustrial.sqms.Ctq not found.
    if (!(ob instanceof Ctq)) {
    ^
    AddCtq.java:170: Class com.geindustrial.sqms.Ctq not found.
    throw new InvalidContentObjectException(ob, (Ctq.class));
    ^
    3 errors
    And when i try to compile Ctq.java , i am getting the following Error:
    Ctq.java:4: Class com.geindustrial.sqms.VariableData not found in import.
    import com.geindustrial.sqms.VariableData;
    ^
    1 error
    How to solve this problem..Pls advise...
    Thanks
    Sateesh

    I suspect you are trying to compile the files one by one. You may also be trying to compile them disregarding the package structure.
    From your post, I gather these files are in the package: com.geindustrial.sqms
    Therefore, if they are not so already, put them under a directory structure:
    com/geindustrial/sqms
    and then compile with:
    javac com/geindustrial/sqms/AddCtq.java com/geindustrial/sqms/Ctq.java com/geindustrial/sqms/VariableData.java
    (The above is all on one line.)
    HTH,
    Manuel Amago.

Maybe you are looking for

  • Trying to Install OS X & Can't Eject CD / DVS

    I erased my hard drive and am now trying to install an operating system. I'm getting the following error....."You cannot install Mac OSX on this volume. An earlier version of Mac OSX is not installed". Now I can't eject the CD / DVD in order to insta

  • Can built-in (primary) LCD sleep while Secondary LCD is awake and active?

    I am not sure how this iMac video-out works on the new Intel iMacs? Can I buy a 30" LCD TV and hook it up to my iMac and have it mirror it but have the built-in LCD sleep? No need for 2 mirrors to run? OR Have both LCD's act as an extended screen but

  • Classic problem: .avi to dvd

    hi guys, im sort of a newbie in macs and looking around the forums, i still can't find an understandable explanation about the problem with burning a .avi into a playable dvd. i tried converting to DV, with a free app someone recommended here (MPEG s

  • New iTunes security changes

    New system I see?

  • Upload bmecat xml into CCM / SRM 4.0

    Hello, I am trying to upload an bmecat XML file via XI into the SAP catalogue. I can fill the predifined characteristics with my XML file but I do not know how to create new characteristics. Does anybody have an example XML file for new characteristi