Strange Compiler Error

Hi, I was wondering if you could help me out with a little problem that I've encountred. When I compile my project, I get the following errors:
Errors:
C:\Program Files\Xinox Software\JCreatorV3 LE\MyProjects\MatrixAddition\MatrixAddition.java:23: illegal start of type
        while(exit == false) {
        ^
C:\Program Files\Xinox Software\JCreatorV3 LE\MyProjects\MatrixAddition\MatrixAddition.java:120: <identifier> expected
^
2 errorsRadReader class:
import java.io.*;
import java.lang.*;
// Use to throw exceptions
class RadReaderException extends RuntimeException { 
     RadReaderException(Throwable cause) {   
          super(cause); 
public class RadReader {       
     public static int readInt(String prompt) {          
     BufferedReader bfRdr = new BufferedReader(new InputStreamReader(System.in));
          // Print the prompt
          if(prompt != "") {
               System.out.print(prompt);
          // Get string input
          int integer = 0;
          String input = "";
          try {
               input = bfRdr.readLine();
          catch(IOException e) {
               throw new RadReaderException(e);
          // Convert to int
          try {
               integer = Integer.parseInt(input);
          catch(NumberFormatException e) {
               throw new RadReaderException(e);
          // Return integer
          return integer;
     public static float readFloat(String prompt) {          
     BufferedReader bfRdr = new BufferedReader(new InputStreamReader(System.in));
          // Print the prompt
          if(prompt != "") {
               System.out.print(prompt);
          // Get string input
          float floatingPt = 0;
          String input = "";
          try {
               input = bfRdr.readLine();
          catch(IOException e) {
               throw new RadReaderException(e);
          // Convert to float
          try {
               floatingPt = Float.parseFloat(input);
          catch(NumberFormatException e) {
               throw new RadReaderException(e);
          // Return floatingPt
          return floatingPt;
     public static double readDouble(String prompt) {          
     BufferedReader bfRdr = new BufferedReader(new InputStreamReader(System.in));
          // Print the prompt
          if(prompt != "") {
               System.out.print(prompt);
          // Get string input
          double dble = 0;
          String input = "";
          try {
               input = bfRdr.readLine();
          catch(IOException e) {
               throw new RadReaderException(e);
          // Convert to double
          try {
               dble = Double.parseDouble(input);
          catch(NumberFormatException e) {
               throw new RadReaderException(e);
          // Return dble
          return dble;
     public static char readChar(String prompt) {          
     BufferedReader bfRdr = new BufferedReader(new InputStreamReader(System.in));
          // Print the prompt
          if(prompt != "") {
               System.out.print(prompt);
          // Get char
          char character = '?';
          try {
               character = (char)bfRdr.read();
          catch(IOException e) {
               throw new RadReaderException(e);
          // Return true if method worked
          return character;
     public static char[] readCharArray(String prompt, int length) {
     BufferedReader bfRdr = new BufferedReader(new InputStreamReader(System.in));
          // Print the prompt
          if(prompt != "") {
               System.out.print(prompt);
          // Get char[]
          char[] array = new char[length];
          try {
               bfRdr.read(array, 0, array.length);
          catch(IOException e) {
               throw new RadReaderException(e);
          // Return true if method worked
          return array;
     public static String readString(String prompt) {        
     BufferedReader bfRdr = new BufferedReader(new InputStreamReader(System.in));     
          // Print the prompt
          if(prompt != "") {
               System.out.print(prompt);
          // Get string input
          String string = "";
          try {
               string = bfRdr.readLine();
          catch(IOException e) {
               throw new RadReaderException(e);     
          // Return true if method works
          return string;
}Main(Matrix Addition):
public class MatrixAddition {
     // Radreader object
     RadReader reader = new Radreader();
     // Instantiate arrays
     int[][] array1 = new int[3][2];
     int[][] array2 = new int[3][2];
     int[][] array3 = new int[3][2];
     // Boolean control variables
     boolean exit = false;
     // Begin while loop
     while(exit == false) {
          // Get user input
          for(int row = 0; row < array1.length; row++) {
               for(int column = 0; column < array1[0].length; column++) {
                    // local storage
                    int element = 0;
                    // Query for input
                    element = reader.readInt("Please enter the value of the " +
                                                   "element at row " + row + " and " +
                                                   "column " + column + ":");
                    // Set input to array1
                    array1[row][column] = element;
          // Get user input
          for(int row = 0; row < array2.length; row++) {
               for(int column = 0; column < array2[0].length; column++) {
                    // local storage
                    int element = 0;
                    // Query for input
                    element = reader.readInt("Please enter the value of the " +
                                                   "element at row " + row + " and " +
                                                   "column " + column + ":");
                    // Set input to array1
                    array2[row][column] = element;
          // Add arrays
          for(int row = 0; row < array3.length; row++) {
               for(int column = 0; column < array3[0].length; column++) {
                    // Set input to array1
                    array3[row][column] = array1[row][column] +array2[row][column];
          // Print arrays
          System.out.println("Array 1");
          for(int row = 0; row < array1.length; row++) {
               for(int column = 0; column < array1[0].length; column++) {
                    System.out.print(array1[row][column] + " ");
               System.out.println();
          System.out.println();
          System.out.println("Plus");
          System.out.println();
          System.out.println("Array 2");
          for(int row = 0; row < array2.length; row++) {
               for(int column = 0; column < array2[0].length; column++) {
                    System.out.print(array2[row][column] + " ");
               System.out.println();
          System.out.println();
          System.out.println("Equals");
          System.out.println();
          for(int row = 0; row < array3.length; row++) {
               for(int column = 0; column < array3[0].length; column++) {
                    System.out.print(array3[row][column] + " ");
               System.out.println();
          // Check for exit flag
          char exitFlag = reader.readChar("Quit?(y/n) ");
          if(exitFlag == 'y' || exitFlag == 'Y') {
               exit = true;
          System.out.println();          
}Please advize me on how to fix my code.
Thanks!

Nothing strange. You can only write a statement (such as a while-loop) inside a block. You can only write a block inside a method declaration or initializer.
Your problem is that you put the while-loop straight inside a class declaration. You should put it inside a method instead.

Similar Messages

  • Strange compilation error...

    I have some java programes in a directory. Separetely all my files gets compiled properly. When i call any class of other file it returns error like bellow. IT WAS WORKING TILL YESTERDAY very well, but suddenly since today morning this is giving bellow error(without making any change in files).
    In my case i have WSCaret.java file which deals with cursor size of text field which is in the same directory. I fire bellow statement :
    txtUserName.setCaret(new WsCaret());and it returns bellow error :
    Login.java:193: cannot resolve symbol
    symbol  : class WsCaret
    location: class Login
                                   txtPassword.setCaret(new WsCaret());
                                                             ^what is the posibility of error. I have java version 1.4.1_02 running on Red Hat Linux9.
    Regards...
    jaya

    yh i have already set class path in my .bash_profile like :
    export PATH=/usr/java/j2sdk1.4.1_02/bin:$PATH
    and i jave compiled WsCaret.java also , there is no error while compiling WsCaret.java, it creates WsCaret.class file also.
    Help me with other sugessions, its very urgent. In fact i have re-installed java also but still same problem.

  • Very strange compile error...

    Hi,
    All my java programs compile fine, except for when I try to set the background color of a component. It's driving me nuts. I've uninstalled and reinstalled the Java JDK, but to no avail. Here's the text of the error message when I attempt to compile.
    Unexpected Signal : EXCEPTION_FLT_STACK_CHECK (0xc0000092) occurred at PC=0xE6D2
    12
    Function=[Unknown.]
    Library=(N/A)
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
    Dynamic libraries:
    0x00400000 - 0x0040B000 C:\j2sdk1.4.2_05\bin\javac.exe
    0x77F50000 - 0x77FF7000 C:\WINDOWS\System32\ntdll.dll
    0x77E60000 - 0x77F46000 C:\WINDOWS\system32\kernel32.dll
    0x77DD0000 - 0x77E5D000 C:\WINDOWS\system32\ADVAPI32.dll
    0x78000000 - 0x7807E000 C:\WINDOWS\system32\RPCRT4.dll
    0x77C10000 - 0x77C63000 C:\WINDOWS\system32\MSVCRT.dll
    0x08000000 - 0x08139000 C:\j2sdk1.4.2_05\jre\bin\client\jvm.dll
    0x77D40000 - 0x77DC6000 C:\WINDOWS\system32\USER32.dll
    0x77C70000 - 0x77CB0000 C:\WINDOWS\system32\GDI32.dll
    0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll
    0x76390000 - 0x763AC000 C:\WINDOWS\System32\IMM32.DLL
    0x629C0000 - 0x629C8000 C:\WINDOWS\System32\LPK.DLL
    0x72FA0000 - 0x72FFA000 C:\WINDOWS\System32\USP10.dll
    0x6BC00000 - 0x6BC14000 C:\WINDOWS\System32\DrvTrNTm.dll
    0x6BC20000 - 0x6BC3D000 C:\WINDOWS\System32\DrvTrNTl.dll
    0x00A20000 - 0x00A94000 C:\WINDOWS\TEMP\qka3.tmp
    0x77340000 - 0x773CB000 C:\WINDOWS\system32\COMCTL32.DLL
    0x71B20000 - 0x71B31000 C:\WINDOWS\system32\MPR.DLL
    0x771B0000 - 0x772C7000 C:\WINDOWS\system32\OLE32.DLL
    0x77120000 - 0x771AB000 C:\WINDOWS\system32\OLEAUT32.DLL
    0x71AD0000 - 0x71AD8000 C:\WINDOWS\System32\WSOCK32.DLL
    0x71AB0000 - 0x71AC5000 C:\WINDOWS\System32\WS2_32.dll
    0x71AA0000 - 0x71AA8000 C:\WINDOWS\System32\WS2HELP.dll
    0x00BC0000 - 0x00BEB000 C:\WINDOWS\System32\msctfime.ime
    0x10000000 - 0x10007000 C:\j2sdk1.4.2_05\jre\bin\hpi.dll
    0x00C00000 - 0x00C0E000 C:\j2sdk1.4.2_05\jre\bin\verify.dll
    0x00C10000 - 0x00C29000 C:\j2sdk1.4.2_05\jre\bin\java.dll
    0x00C30000 - 0x00C3D000 C:\j2sdk1.4.2_05\jre\bin\zip.dll
    0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll
    0x6D510000 - 0x6D58D000 C:\WINDOWS\system32\DBGHELP.dll
    0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll
    0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL
    Heap at VM Abort:
    Heap
    def new generation total 576K, used 362K [0x10010000, 0x100b0000, 0x104f0000)
    eden
    Another exception has been detected while we were handling last error.
    Dumping information about last error:
    ERROR REPORT FILE = (N/A)
    PC = 0x00e6d212
    SIGNAL = -1073741678
    FUNCTION NAME = (N/A)
    OFFSET = 0xFFFFFFFF
    LIBRARY NAME = (N/A)
    Please check ERROR REPORT FILE for further information, if there is any.
    Good bye.
    And here' s the block of code that causes the error... if I comment out the line
    panel.setBackground(Color.white)it compiles without error.
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createLoweredBevelBorder());
    panel.setPreferredSize(new Dimension(400,300));
    panel.setBackground(Color.white);I am running Windows XP Home Edition. Any ideas? Help is greatly appreciated.
    Nick

    Your JVM crashed when you compile your file. This is unusual.
    If your can reproduce this with a small test-case, I suggest you
    filke a bug here: http://bugs.sun.com/services/bugreport/index.jsp
    --Alexis                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Strange Compile error

    Hello again all, I am studying Java and came across an interesting program from Elliotte Rusty Harold at UNC.
    The original code is:
    // This is the Hello program in Java
    class Hello
        public static void main (String args[])
          if (args.length == 0) {
            System.out.println(
              "Hello whoever you are");
        else if (args.length == 1) {
            System.out.println("Hello " + args[0]);
          else if (args.length == 2) {
            System.out.println("Hello " + args[0] +
              " " + args[1]);
          else if (args.length == 3) {
            System.out.println("Hello " + args[0] +
              " " + args[1] + " " args[2]);
          else if (args.length == 4) {
            System.out.println("Hello " + args[0] +
              " " + args[1] + " " args[2] +
              " " + args[3]);
          else {
            System.out.println("Hello " + args[0] +
            " " + args[1] + " " args[2] + " " +
            args[3] + " and all the rest!");
    Copyright 1996 Elliotte Rusty Harold
    [email protected]
    */This code will not compile using Java jdk-6u6-windows-i586-p.exe build.
    If I remark out the code as follows it works
    // This is the Hello program in Java
    class Hello
        public static void main (String args[])
          if (args.length == 0) {
            System.out.println(
              "Hello whoever you are");
        else if (args.length == 1) {
            System.out.println("Hello " + args[0]);
          else if (args.length == 2) {
            System.out.println("Hello " + args[0] +
              " " + args[1]);
         /* else if (args.length == 3) {
            System.out.println("Hello " + args[0] +
              " " + args[1] + " " args[2]);
          else if (args.length == 4) {
            System.out.println("Hello " + args[0] +
              " " + args[1] + " " args[2] +
              " " + args[3]);
          else {
            System.out.println("Hello " + args[0] +
            " " + args[1] + " " args[2] + " " +
            args[3] + " and all the rest!");
    }Un-remarking any additional else if's gives "Illegal start of expression" errors.
    Any ideas? Does the code compile on your machines/PC's?
    Thanks in advance

    Stev0 wrote:
    Hello again all, I am studying Java and came across an interesting program from Elliotte Rusty Harold at UNC.
    The original code is:
    // This is the Hello program in Java
    class Hello
    public static void main (String args[])
    if (args.length == 0) {
    System.out.println(
    "Hello whoever you are");
    else if (args.length == 1) {
    System.out.println("Hello " + args[0]);
    else if (args.length == 2) {
    System.out.println("Hello " + args[0] +
    " " + args[1]);
    else if (args.length == 3) {
    System.out.println("Hello " + args[0] +
    " " + args[1] + " " args[2]);
    else if (args.length == 4) {
    System.out.println("Hello " + args[0] +
    " " + args[1] + " " args[2] +
    " " + args[3]);
    else {
    System.out.println("Hello " + args[0] +
    " " + args[1] + " " args[2] + " " +
    args[3] + " and all the rest!");
    Copyright 1996 Elliotte Rusty Harold
    [email protected]
    The compiler is right. Take a closer look at the lines that cause the errors. Try to figure out what's in the last three elses that isn't in the first one.

  • Very strange compile error PLEASE HELP

    in one class (Slanje) I defined method
    public void(String host,String from,String to,String subject,String messagetext){.....
    in other (Prikaz) I create an instance of class Slanje and try to use:
    Slanje n=new Slanje();
    n.infos(host,from,to,subjecta,poruka);
    where to and subjecta getting from JTextField, using method getText();
    but get following error mesage:
    C:\javafile\samostalni\Mailpr\Prikaz.java:117: infos(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) in Slanje cannot be applied to (java.lang.String,java.lang.String,java.lang.String,javax.swing.JTextField,java.lang.String)
              n.infos(host,from,to,subjecta,poruka);
    I don't get it. what is the difference, both takes String

    I know, but isn't it string because I used getText;
    anyway how can I avoid that.
    Is there some another way ( I tried to use cast operator (String)) but no success.
    Help me someone, please!

  • An XJC compilation error - Could not load class (..) for type cvsversion

    I've got a strange compilation error using NetBeans 4.0 (I'd guess the version does not matter here) and Ant 1.6.2. When the following task is executed,
    <target name="compile_ofx_schema">
    <antcall target="clean-ofx"/>
    <delete dir="${ofx-jaxb-src.dir}"/>
    <mkdir dir="${ofx-jaxb-src.dir}" />
    <xjc schema="${schema.dir}/ofx102.xsd" package="com.xxx.ofx102" target="${ofx-jaxb-src.dir}">
    <arg value="-nv" />
    <arg value="-extension" />
    </xjc>
    </target>
    I get the error from NetBeans console,
    Class org.xml.sax.SAXException loaded from parent loader (parentFirst)
    Class java.io.IOException loaded from parent loader (parentFirst)
    D:\appserver\build.xml:797: unable to parse the schema. Error messages should have been provided
    at com.sun.tools.xjc.XJCTask._doXJC(XJCTask.java:334)
    at com.sun.tools.xjc.XJCTask.doXJC(XJCTask.java:283)
    at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:227)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:217)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:236)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:125)
    BUILD FAILED (total time: 4 seconds)
    Could not load class (org.apache.tools.ant.tasksdefs.cvslib.CvsVersion) for type cvsversion
    Could not load class (org.apache.tools.ant.tasksdefs.cvslib.CvsVersion) for type cvsversion
    And when I run the Ant task from the command line, I don't get the error at all.
    Any help is greatly appreciated.

    That was a great finding from you. Thank you.
    I followed your alternative approach and updated the ant.jar file. The "Could not load class..." error went away but the stack trace still remains. Now I am clueless again since I have ant on the debug mode and can't find any more useful info.
    Class com.sun.tools.xjc.reader.internalizer.LocatorTable loaded from ant loader (parentFirst)
    Class java.util.HashSet loaded from parent loader (parentFirst)
    Class javax.xml.parsers.DocumentBuilderFactory loaded from parent loader (parentFirst)
    Couldn't load Resource org/netbeans/core/xml/DOMFactoryImpl.class
    Couldn't load ResourceStream for META-INF/services/javax.xml.parsers.DocumentBuilderFactory
    Class org.apache.crimson.jaxp.DocumentBuilderFactoryImpl loaded from parent loader (parentFirst)
    Class javax.xml.parsers.SAXParserFactory loaded from parent loader (parentFirst)
    Couldn't load Resource org/netbeans/core/xml/SAXFactoryImpl.class
    Couldn't load ResourceStream for META-INF/services/javax.xml.parsers.SAXParserFactory
    Class org.apache.crimson.jaxp.SAXParserFactoryImpl loaded from parent loader (parentFirst)
    Class javax.xml.parsers.DocumentBuilder loaded from parent loader (parentFirst)
    Class java.util.Map loaded from parent loader (parentFirst)
    Class javax.xml.parsers.SAXParser loaded from parent loader (parentFirst)
    Finding class com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic$ReferenceFinder
    Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/xmlschema/parser/XMLSchemaInternalizationLogic$ReferenceFinder.class
    Finding class com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl
    Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/internalizer/AbstractReferenceFinderImpl.class
    Class org.xml.sax.helpers.XMLFilterImpl loaded from parent loader (parentFirst)
    Class com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl loaded from ant loader (parentFirst)
    Class com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic$ReferenceFinder loaded from ant loader (parentFirst)
    Class org.xml.sax.XMLFilter loaded from parent loader (parentFirst)
    Finding class com.sun.tools.xjc.reader.internalizer.VersionChecker
    Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/internalizer/VersionChecker.class
    Class com.sun.tools.xjc.reader.internalizer.VersionChecker loaded from ant loader (parentFirst)
    Finding class com.sun.tools.xjc.reader.internalizer.DOMBuilder
    Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/internalizer/DOMBuilder.class
    Finding class com.sun.xml.bind.marshaller.SAX2DOMEx
    Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-impl.jar com/sun/xml/bind/marshaller/SAX2DOMEx.class
    Class org.xml.sax.ContentHandler loaded from parent loader (parentFirst)
    Class com.sun.xml.bind.marshaller.SAX2DOMEx loaded from ant loader (parentFirst)
    Class com.sun.tools.xjc.reader.internalizer.DOMBuilder loaded from ant loader (parentFirst)
    Class java.util.Stack loaded from parent loader (parentFirst)
    Class org.w3c.dom.Document loaded from parent loader (parentFirst)
    Class org.xml.sax.XMLReader loaded from parent loader (parentFirst)
    Class org.w3c.dom.Node loaded from parent loader (parentFirst)
    Class org.w3c.dom.Element loaded from parent loader (parentFirst)
    Class javax.xml.parsers.ParserConfigurationException loaded from parent loader (parentFirst)
    Class org.xml.sax.SAXException loaded from parent loader (parentFirst)
    Class java.io.IOException loaded from parent loader (parentFirst)
    D:\bbw\build\Common_3.6\Packaged\appserver\build.xml:799: unable to parse the schema. Error messages should have been provided
    at com.sun.tools.xjc.XJCTask._doXJC(XJCTask.java:334)
    at com.sun.tools.xjc.XJCTask.doXJC(XJCTask.java:283)
    at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:227)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:217)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:236)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:125)
    BUILD FAILED (total time: 1 second)
    Any suggestions? BTW, I did not upgrade NetBeans to v5.5 due that my code is still JDK1.4 based.

  • Compile error in adjacency matrix

    Hello, I'm getting a strange compile error in my fileStream constructor
    also I'm having trouble accessing nodes.
    Any advice is much much appreciated and will be rewarded as such
    cheers
    mport java.io.*;
    import java.util.*;
    class AdjMatrix
         private int [][] matrix;
         private int num_vertices;
         private final int inf = Integer.MAX_VALUE;
         public AdjMatrix(int num_vertices)
              this.num_vertices = num_vertices;
              matrix = new int[num_vertices][num_vertices];
              // let's assume that nodes are adjacent to themselves
              for (int vertex = 0; vertex < num_vertices; vertex++)
                   for (int other_vertex = 0; other_vertex < num_vertices; other_vertex++)
                        if (other_vertex == vertex)
                             matrix[vertex][other_vertex] = 0;
                        else
                             matrix[vertex][other_vertex] = inf;
         public void addEdge(int vertex_from, int vertex_to, int cost)
              matrix[vertex_from][vertex_to] = cost;
         public void addEdge(int vertex_from, int vertex_to)
              addEdge(vertex_from, vertex_to, 0);
         public void addBidirectedEdge(int vertex_one, int vertex_two, int cost)
              addEdge(vertex_one, vertex_two, cost);
              addEdge(vertex_two, vertex_one, cost);
         public void addBidirectedEdge(int vertex_one, int vertex_two)
              addEdge(vertex_one, vertex_two, 0);
              addEdge(vertex_two, vertex_one, 0);
         public void removeEdge(int vertex_from, int vertex_to)
              matrix[vertex_from][vertex_to] = inf;
         public void removeBidirectedEdge(int vertex_one, int vertex_two)
              matrix[vertex_one][vertex_two] = inf;
              matrix[vertex_two][vertex_one] = inf;
         public int getEdge(int vertex_from, int vertex_to)
              return matrix[vertex_from][vertex_to];
    class FileStream extends AdjMatrix {
         double answer;
         String line;
         AdjMatrix theMatrix;
         int total;
         public FileStream(String fileName) {
              fileName = "Test.txt";
              try {
                   FileReader fileRead = new FileReader(fileName);
                   BufferedReader br = new BufferedReader(fileRead);
                   while((line = br.readLine()) !=null) {
                        StringTokenizer st = new StringTokenizer(line, ",");
                        total++;
                        for(int i=0; i<st.countTokens(); i++){
                             for(int j=0; j<st.countTokens(); j++) {
                                  int weight = Integer.parseInt(st.nextToken());
                                  theMatrix.addEdge(i,j,weight);
                   br.close();
              catch(IOException exc) {
                   System.out.println("File not found!");
         //System.out.println("The total in [Test.txt] is: " +total);     
    }

    class FileStream extends AdjMatrix {
         double answer;
         String line;
         AdjMatrix theMatrix;
         int total;
         public FileStream(String fileName) {
              Since you don't specify which constructor of AdjMatrix to use in the contruction of FileStream the compiler is trying to use the default constructor of AdjMatrix BUT you don't have one!
    Possible solutions -
    1) Define a default constructor in AdjMatrix.
    2) Use the public AdjMatrix(int num_vertices) constructor by using
         public FileStream(String fileName) {
                 super(10); // or what ever size you think is appropriate3) Change AdjMatrix to use so as to use dynamic arrays (ArrayList?) instead of having a fixed dimension.
    4) MakeFile stream a factory that does not extend AdjMatrix but has a method that returns an AdjMatrix based on a filename argument.
    e.g.
    class  FileStreamFactory
         public AdjMatrix createFromFile(String filename)
                 // Parse the file to get the size
                AdjMatrix theMatrix = new AdMatrix(the size you parsed);
                // Fill in anything else you need to
                return  theMatrix ;
    }You would use this by creating a factory and then using it to create your AdjMatrix.
    It should be obvious that I prefer approach 4.
    Have fun!

  • Strange New Compile Error

    I was just compiling a project and I got the following
    strange new error written to c:\.err.
    Friday, April 25, 2008 17:08:13
    HHA Version 4.74.8702
    htmlproc.cpp(114) : Assertion failure: (pszTmp ==
    m_pCompiler->m_pHtmlMem->psz)
    The only 'major' change made to the project was an update to
    the existing Index, and deletion of a number of spurious entries
    therein.
    What is this error and what can I do about it?
    Any Advice?

    Just got this error again:
    Monday, May 05, 2008 11:25:23
    HHA Version 4.74.8702
    htmlproc.cpp(114) : Assertion failure: (pszTmp ==
    m_pCompiler->m_pHtmlMem->psz)
    Strangely, I have not increased the size of the index since
    the last successful compile.
    I am curious as to what other aspects of this
    formerly-successfully-compiled-project may lead to this error.
    Vivek, could you please provide any insight? Thank
    you.

  • Compilation error[ORA-02289: sequence does not exist] ,even if dbVersion '9.3.350',so strange!

    I know the reason is that PL/SQL is pre-compilation, so now dbVersion < '9.3.350', even if I don't need get REFDESIG_ID_SEQ.nextval ,
    it will also cause this compilation error. So my question is how should I code that?
    When dbVersion < '9.3.350' , no sequence REFDESIG_ID_SEQ, just print '1####';
    else get REFDESIG_ID_SEQ.nextval , then print '2####'
    But now even if dbVersion < '9.3.350', it will cause compilation error[ORA-02289: sequence does not exist] .
    How to resolve this? Thanks a lot.
    declare
        maxid   number;
        nextid number;
        agileid number;
        v_date  date;
        dbVersion varchar(8):=0;
    begin
      select substr(value,1,7) into dbVersion from propertytable where parentid = 5001 and propertyid=37;
            DBMS_OUTPUT.PUT_LINE(dbVersion);
            if (dbVersion < '9.3.350') then
                  DBMS_OUTPUT.PUT_LINE('1####');
            else
                  DBMS_OUTPUT.PUT_LINE('2####');
                  select REFDESIG_ID_SEQ.nextval into agileid from dual;
            end if;
    end;

    In my DB, If dbVersion < '9.3.350' , no sequence REFDESIG_ID_SEQ
    When dbVersion >= '9.3.350' ,sequence REFDESIG_ID_SEQ will exist,
    Now my dbVersion < '9.3.350' , and this pl/sql also cause this error.
    SO how should I to resolve it ?
    Now I need a test case, if dbVersion < '9.3.350' , then print '1####';
    else , get REFDESIG_ID_SEQ.nextval   firstly , then print '2####'
    How should I code?Thanks  a lot.

  • Compiler error when useing switch statements in an inner class

    I have defined several constants in a class and want to use this constans also in an inner class.
    All the constants are defined as private static final int.
    All works fine except when useing the switch statement in the inner class. I get the compiler error ""constant expression required". If I change the definition from private static final to protected static final it works, but why?
    What's the difference?
    Look at an example:
    public class Switchtest
       private static final int AA = 0;     
       protected static final int BB = 1;     
       private static int i = 0;
       public Switchtest()
          i = 0; // <- OK
          switch(i)
             case AA: break; //<- OK, funny no problem
             case BB: break; //<- OK
             default: break;
      private class InnerClass
          public InnerClass()
             i = 0; // <- OK: is accessible
             if (AA == i) // <- OK: AA is seen by the inner class; i  is also accessible
                i = AA + 1;
             switch(i)
                case AA: break; // <- STRANGE?! Fail: Constant expression required
                case BB: break; // <- OK
                default: break;
    }Thank's a lot for an explanation.

    Just a though:
    Maybe some subclass of Switchtest could decalare its own variable AA that is not final, but it can not declare its own BB because it is visible from the superclass. Therefore the compiler can not know for sure that AA is final.

  • Compilation error in PL/SQL

    Hi All,
    Please find the strange query situation in PLSQL.
    If i run the query without PLSQL block (i.e. declar begin end) it runs well and insert data
    in table but if put the same query in PLSQL block it gives compilation error.
    Following is the spool
    SQL> select * from v$version;
    BANNER                                                                                                                                     
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production                                                                                 
    PL/SQL Release 8.1.7.4.0 - Production                                                                                                      
    CORE     8.1.7.0.0     Production                                                                                                                  
    TNS for IBM/AIX RISC System/6000: Version 8.1.7.4.0 - Production                                                                           
    NLSRTL Version 3.4.1.0.0 - Production                                                                                                      
    SQL> insert into smcbom_load_hours_temp
      2  select data_set_name,deptclass,dept,smcbom_flex_budget.get_period(v_date) v_period,sum(v_hr),-1,sysdate,-1,sysdate
      3  from (
      4  select plan_level,sp.data_set_name,
      5  sp.value1,smcbom_flex_budget.calculate_period_days(sp.period1),inweight ,
      6  usagerate ,operationseq,percent,
      7  sbov.group_id,sp.alloy,sp.planner_code,
      8  sbov.days,sbov.totaloffsetdays,deptclass,dept,
      9  decode(plan_level,1,(sp.value14/smcbom_flex_budget.calculate_period_days(sp.period14)) * (percent/100) * inweight * usagerate *
    10  (SELECT MAX(INWEIGHT)
    11  FROM  SMCBOM_BOM_OPERATION_VIEW
    12  WHERE ALLOY=sbov.alloy
    13  AND   PLANNER_CODE=sbov.planner_code
    14  AND   PLAN_LEVEL = 0
    15  AND   GROUP_ID = sbov.group_id ),
    16  0,(sp.value14/smcbom_flex_budget.calculate_period_days(sp.period14)) * (percent/100) * inweight * usagerate ,
    17  1) v_hr,
    18  smcbom_flex_budget.get_start_date(sp.period14)+sbov.totaloffsetdays v_date,
    19  sum(-sbov.totaloffsetdays)
    20  over (partition by sp.alloy,sp.planner_code,sbov.group_id
    21  order by plan_level asc,operationseq desc)  new_offset
    22  from smcbom_bom_operation_view sbov,smcbom_sales_prod_forecasts sp
    23  where sbov.alloy= sp.alloy
    24  and   sbov.planner_code=sp.planner_code
    25  and group_id=521136
    26  )
    27  group by data_set_name,deptclass,dept,smcbom_flex_budget.get_period(v_date);
    23 rows created.
    SQL> commit;
    Commit complete.
    SQL> declare
      2  begin
      3  insert into smcbom_load_hours_temp
      4  select data_set_name,deptclass,dept,smcbom_flex_budget.get_period(v_date) v_period,sum(v_hr),-1,sysdate,-1,sysdate
      5  from (
      6  select plan_level,sp.data_set_name,
      7  sp.value1,smcbom_flex_budget.calculate_period_days(sp.period1),inweight ,
      8  usagerate ,operationseq,percent,
      9  sbov.group_id,sp.alloy,sp.planner_code,
    10  sbov.days,sbov.totaloffsetdays,deptclass,dept,
    11  decode(plan_level,1,(sp.value14/smcbom_flex_budget.calculate_period_days(sp.period14)) * (percent/100) * inweight * usagerate *
    12  (SELECT MAX(INWEIGHT)
    13  FROM  SMCBOM_BOM_OPERATION_VIEW
    14  WHERE ALLOY=sbov.alloy
    15  AND   PLANNER_CODE=sbov.planner_code
    16  AND   PLAN_LEVEL = 0
    17  AND   GROUP_ID = sbov.group_id ),
    18  0,(sp.value14/smcbom_flex_budget.calculate_period_days(sp.period14)) * (percent/100) * inweight * usagerate ,
    19  1) v_hr,
    20  smcbom_flex_budget.get_start_date(sp.period14)+sbov.totaloffsetdays v_date,
    21  sum(-sbov.totaloffsetdays)
    22  over (partition by sp.alloy,sp.planner_code,sbov.group_id
    23  order by plan_level asc,operationseq desc)  new_offset
    24  from smcbom_bom_operation_view sbov,smcbom_sales_prod_forecasts sp
    25  where sbov.alloy= sp.alloy
    26  and   sbov.planner_code=sp.planner_code
    27  and group_id=521136
    28  )
    29  group by data_set_name,deptclass,dept,smcbom_flex_budget.get_period(v_date);
    30  end;
    31  /
    (SELECT MAX(INWEIGHT)
    ERROR at line 12:
    ORA-06550: line 12, column 2:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + mod not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string>
    ORA-06550: line 22, column 6:
    PLS-00103: Encountered the symbol "(" when expecting one of the following:
    , from
    SQL> spool off;

    In some versions of Oracle (certainly all of the 8.x versions and earlier, and possibly some of the earlier 9 versions) the SQL parsers in the SQL engine and in the PL/SQL engine were different. Some features that worked directly in SQL did not work in PL/SQL. Scalar sub-queries were one of those things.
    You have three options. You can try to re-write the insert statement to eliminate the PL/SQL unimplemented feature. You can create a view in the database for the SELECT part of the insert statement then use that view in the insert. finally, and least desirable, you can build the whole statment as a string, and use EXECUTE IMMEDIATE to run it in PL/SQL.
    HTH
    John

  • Compilation error occurred

    i get this error when i try to deploy a web service. is there a way to debug the oc4j compilation process?
    it's behaving VERY strange.. everything is ok if the webmethod is returning a class of name: "Class1", but if i rename it to "HolidayDto" i get this error.

    the whole error i've got was: error deploying ear: compilation error occurred or something similar...
    the problem was, that the HolidayDto had a property of type: java.util.List. i'm aware of the fact that WS methods cannot work with such types, but there surely are better error messages for this than: "blah, blah: compilation error occurred"
    anyway when i've changed the property name from "reviews" to "reviewsList" everything started working..
    what i still dont understand why it worked when the class name of the particular class was Class1.. strange

  • "ORA-24344: success with compilation error" in beginDDL

    Hello,
    I'm facing a really strange problem. When i try to use dbms_wm.beginDDL in one of my versioned tables, i get the error:
    ORA-24344: success with compilation error
    ORA-06512: "WMSYS.LT", line 12178
    ORA-06512: line 2
    I just get the error if i run the procedure from SQLPlus.
    Using PLSQL Developer, for example, I get a normal execution but the LTS table it's not created and the state of the table stays 'VERSIONED'.
    I used this procedure other times in the past and there were no problems.
    Trying to identify the cause of the error, i've tried:
    (1) - run dbms_wm.beginDDL for all the other tables - No Problem
    (2) - verifiy if there were invalid objects - All valid
    (3) - verify the error tables for more details (user_, dba_, user_wm_vt_) - No entries
    (4) - generate a trace file, to search for abnormal executions - Apparently nothing really strange (but obviously I don't know what was supposed to happen)
    Any possible reasons for this to happen?
    Any ideas?
    Some help would be welcome.
    Best regards,
    Pedro Lourenço

    Hi Noel,
    I just found the problem...
    I have a trigger defined on the table that uses a synonym for another user table.
    That synomym was dropped, so the trigger was invalid.
    I didn't notice the problem because the trigger was disabled, so the WM$ procedure wasn't being generated, and there were no "visible errors".
    Recreating the synomyn, the problem was solved.
    Thanks for your help!
    Regards,
    Pedro Lourenço

  • SSUS 2012 Script Component (VB) Build But Still Has Compile Error

    The title says it all really.
    The Script Component builds without error but when I close the editor (and when I execute the package), I get a message saying that there is a compile error. There is of course a big red "X on the script component. No errors are indicated in the edit
    window or when building the script. Can anyone help? this is really holding me up.
    The script has been copied from a working SSIS 2008 package. It uses the report execution web method. I have successfully changed the web reference to ReportExcution2010, there doesn't seem to be a RepprtExcution2012.
    R Campbell

    It's probably best to close thread and that I start a new one. I think that I have gone off on a tangent here. Yes SSIS isn't doing much of a job in reporting errors but my main concern is the error itself.
    I am trying to port an SSIS Script Task from SQL 2008 to SQL 2012. Is uses the ReportExecution2005 web service to run SSRS reports. The really strange thing is that, even though the same web reference is used, different methods seem
    to be available in SQL 2008 and SQL 2012. This doesn't sound right to me, if you refer to the same Web Service you should see the same metros or am I wrong about that.
    For example in SQL 2008 there is ReportExecutionService
    object but on the SQL 2012 to service there only seems to be
    ReportExecutionServiceSOAPClient.
    R Campbell

  • Help- Components Throwing Compile Errors

    Thank you for reading my issue. I am using Flash CS3.
    Recently, all my projects began throwing compile errors for
    standard component AS3 code.
    UI Component, FLVPlayback.
    I have uninstalled and reinstalled Flash CS3, but to no
    avail. Problem persists
    I keep getting errors involving "QNAN", which I think
    involves trapping for a non-numeric value, or something.
    As a test, I created a new Flash doc, placed an instance of
    FLVPlayback on the stage, pointed it to a .FLV file in the same
    directory.
    Errors on compile:
    1093: Syntax error.
    1084: Syntax error: expecting rightparen before QNAN.
    1093: Syntax error.
    1084: Syntax error: expecting rightparen before QNAN.
    And so on, I get 5 sets of the same errors for different
    functions.
    The first offending function above reads:
    function queueCmd(param1:VideoPlayerState, param2:Number,
    param3:Number = 1.#QNAN) : void
    if (param1.cmdQueue == null)
    param1.cmdQueue = new Array();
    }// end if
    param1.cmdQueue.push(new QueuedCommand(param2, null, false,
    param3));
    return;
    }// end function
    I get similar errors from my UI component AS3 as well.
    I have not touched the shipped AS3 for these components. What
    gives?
    Any ideas?
    Thanks
    Tim

    Thanks, by the way to everyone who has offered thoughts so
    far.
    xchanin - I've encountered issues with the FLVPlayback
    component as well as various of the UI components.
    I tried some example applications (from the web) not too long
    ago and this issue popped up shortly there after.
    But, I'm having issues with even a simple Flash with a single
    FLVPlayback instance and one .flv.
    There is nothing in the class path for my test file and the
    root .as files open from the Flash install when I click the compile
    errors in the output window.
    So, it really looks like I somehow corrupted those files. I
    read a post somewhere that someone had "strange invisible
    characters" show up in their .as that were throwing errors.
    I thought a clean install would do the trick.
    I may completely isolate the example files I was using and
    try another reinstall... that's about all I can think of at the
    moment.
    This has been a couple week search for a solution. I have a
    real project coming up an need to solve this.
    Thanks for any input! (I assume I can't call Adobe for an
    assist as I'm still on CS3 ;)
    Tim

Maybe you are looking for