Error in RMI simple code!

i am using 4 files for rmi
//Interface file
public interface Calculator extends java.rmi.Remote{
public long add(long a,long b)throws java.rmi.RemoteException;
public long sub(long a,long b)throws java.rmi.RemoteException;
public long mul(long a,long b)throws java.rmi.RemoteException;
public long div(long a,long b)throws java.rmi.RemoteException;
//Implementation file
public class CalculatorImpl extends java.rmi.server.UnicastRemoteObject
implements Calculator{
public CalculatorImpl() throws java.rmi.RemoteException
super();
public long add(long a, long b) throws RemoteException {
return(a+b);
public long sub(long a, long b) throws RemoteException {
return(a-b);
public long mul(long a, long b) throws RemoteException {
return(a*b);
public long div(long a, long b) throws RemoteException {
return(a/b);
//Server File
import java.rmi.Naming;
* To change this template, choose Tools | Templates
* and open the template in the editor.
* @author Vedita
public class CalculatorServer {
public CalculatorServer(){
try{
Calculator c = (Calculator) new CalculatorImpl();
Naming.rebind("rmi://localhost:1099/Calculator", c);
catch (Exception e) {
System.out.println("Trouble"+e);
public static void main(String args[]){
new CalculatorServer();
//Client File
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
* To change this template, choose Tools | Templates
* and open the template in the editor.
* @author Vedita
public class CalculatorClient {
public static void main(String args[]) throws NotBoundException, MalformedURLException, RemoteException{
try{
Calculator c= (Calculator) Naming.lookup("rmi://remotehost:1099/Calculator");
System.out.println(c.sub(4, 3));
System.out.println(c.add(4, 5));
System.out.println(c.mul(3, 6));
System.out.println(c.div(9, 3));
catch(MalformedURLException murle){
System.out.println();
System.out.println("MalformedURLException");
System.out.println(murle);
catch(RemoteException re){
System.out.println();
System.out.println("RemoteException");
System.out.println(re);
catch(NotBoundException nbe){
System.out.println();
System.out.println("NotBoundException");
System.out.println(nbe);
catch(java.lang.ArithmeticException ae){
System.out.println();
System.out.println("ArithmeticException");
System.out.println(ae);
i am executing the code as follows in command prompt
in one cmd prompt
javac *.java
rmic CalculatorImpl
rmiregistry
in other cmd prompt
javac *.java
java CalculatorServer
i am getting this error
Error java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: CalculatorImpl_Stub
Please Please help me because i have to submit the project in my college and this basic program is also not working in my pc. Please can anyone help me?

//Implementation file
public class CalculatorImpl extends java.rmi.server.UnicastRemoteObject
implements Calculator{
public CalculatorImpl() throws java.rmi.RemoteException
super();super(0);

Similar Messages

  • Facing syntax error in this simple code snippet

    select case
    when to_number (to_char(sysdate,'mm')) < 7
    then (to_number(to_char(sysdate,'yyyy')) - 1)
    from dual
    --while if in block works fine
    declare
    year number;
    begin
    year := to_number(to_char(sysdate,'yyyy'));
    if (to_number(to_char(sysdate,'mm')) < 7) then
    year := year - 1;
    end if;
    dbms_output.put_line('year = '|| year);
    end;

    You can have:
    -- 1 case expression
    -- 1.2 searched case expressions
    -- 2 simple case statement
    -- 2.1 searched case statement
    In your case you need the first one(-- 1 case expression ), because you return an expression.
    Indeed a simple case statement let you choose a sequence of PL/SQL statements to execute. This follows another syntax.
    It's not always true this statements
    In PL/SQL you would use "END CASE". For this reason I can quietly show you that I can even use 'case expression' in PL/SQL, without end case:
    DECLARE
        subtype TTempWord is varchar2(20);         -- good notation :-)
        valToCompare constant tTempWord:='test';
        temp  tTempWord ;  
        temp2 tTempWord ;
        --- start locals-------     ;-)
        procedure Compare_Display  -- with no parameters just for this dummy test!
        is
        begin
          dbms_output.put_line('Word to compare:'||valToCompare); 
          dbms_output.put_line('temp:'||temp);
          dbms_output.put_line('temp2:'||nvl(temp2,'not assigned'));
          temp2:= case temp when valToCompare then 'identic ' else 'NOT identic' end ; -- I'm  not using *'END CASE'*
          dbms_output.put_line('    --- after the assignation --->');
          dbms_output.put_line('temp:'||temp);
          dbms_output.put_line('temp2:'||temp2);        
          dbms_output.new_line;dbms_output.new_line;
        end;
        --- end locals-------     ;-)
    BEGIN
          temp:='testttt'; 
          Compare_Display ;
          temp:=valToCompare;
          temp2:='';
          Compare_Display ;
    END;--output
    Word to compare:test
    temp:testttt
    temp2:not assigned
        --- after the assignation --->
    temp:testttt
    temp2:NOT identic
    Word to compare:test
    temp:test
    temp2:not assigned
        --- after the assignation --->
    temp:test
    temp2:identic
    PS:for more explanations related to all the cases you could look for at http://tahiti.oracle.com/
    Edited by: zep111 on Apr 28, 2011 11:25 AM

  • Ask for help( simple code but wired error )!

    The post I sent just now has some mistakes. This post is correct. My simple code is as follows:
    import java.io.*;
    import java.net.*;
    public class count {
    float dclient = (float)3.333;
    float dlan = (float)0.01884;
    float drouter = (float)0.00115;
    float doutlink = (float)0.04185;
    float dinternet = (float)1.2615;
    float dinlink = (float)3.18129;
    float client1 = 0;
    float lan1 = 0;
    float router1 = 0;
    float outlink1 = 0;
    float internet1 = 0;
    float inlink1 = 0;
    float client2 = 0;
    float lan2 = 0;
    float router2 = 0;
    float outlink2 = 0;
    float internet2 = 0;
    float inlink2 = 0;
    float x = 0;
    float z = (float)3.333;
    public static void main(String[] args) {
    for (int n=1; n<16; ++n)
    client1 = dclient;
    lan1 = dlan * (1+lan2);
    router1 = drouter;
    outlink1 = doutlink * (1+outlink2);
    internet1 = dinternet;
    inlink1 = dinlink * (1+inlink2);
    x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
    client2 = x * client1;
    lan2 = x * lan1;
    rounter2 = x * rounter1;
    outlink2 = x * outlink1;
    internet2 = x * internet1;
    inlink2 = x * inlink1;
    System.out.println(client1 + " " +
    lan1 + " " +
    rounter1 + " " +
    outlink1 + " " +
    internet1+ " " +
    inlink1+ " **** " +
    x + " **** " +
    client2 + " " +
    lan2 + " " +
    rounter2 + " " +
    outlink2 + " " +
    internet2+ " " +
    inlink2 + " ********************end of n = " + n + "************************"
    The compiling error is:
    count.java:43: Can't make a static reference to nonstatic variable dclient in class count.
    client1 = dclient;
    ^
    1 error
    What is wrong with it? Many thanks!

    import java.io.*;
    import java.net.*;
    public class count
         public static float dclient = (float)3.333;
         public static float dlan = (float)0.01884;
         public static float drouter = (float)0.00115;
         public static float doutlink = (float)0.04185;
         public static float dinternet = (float)1.2615;
         public static float dinlink = (float)3.18129;
         public static float client1 = 0;
         public static float lan1 = 0;
         public static float router1 = 0;
         public static float outlink1 = 0;
         public static float internet1 = 0;
         public static float inlink1 = 0;
         public static float client2 = 0;
         public static float lan2 = 0;
         public static float router2 = 0;
         public static float outlink2 = 0;
         public static float internet2 = 0;
         public static float inlink2 = 0;
         public static float x = 0;
         public static float z = (float)3.333;
         public static void main(String[] args)
              for (int n=1; n<16; ++n)
                   client1 = dclient;
                   lan1 = dlan * (1+lan2);
                   router1 = drouter;
                   outlink1 = doutlink * (1+outlink2);
                   internet1 = dinternet;
                   inlink1 = dinlink * (1+inlink2);
                   x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
                   client2 = x * client1;
                   lan2 = x * lan1;
                   router2 = x * router1;
                   outlink2 = x * outlink1;
                   internet2 = x * internet1;
                   inlink2 = x * inlink1;
                   System.out.println(client1 + " " +     lan1 + " " router1 " " outlink1 " " internet1 " " inlink1 " **** " +     x + " **** " +
                   client2 + " " +
                   lan2 + " " +
                   router2 + " " +
                   outlink2 + " " +
                   internet2+ " " +
                   inlink2 + " ********************end of n = " + n + "************************"

  • JMS Simple code in Sun tutorial

    I run a simple code (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMS4.html) fine in j2sdkee , but fail to use in Openjms/ JBoss.
    try {
    connectionFactory = (ConnectionFactory) jndiContext.lookup("QueueConnectionFactory");
    } catch (Exception e) {
    System.out.println("JNDI API lookup failed: " + e.toString());
    return;
    What's wrong of the above code? Why do I can the following error in Openjms / Jboss?
    JNDI API lookup failed: javax.naming.CommunicationException: Can't find

    OpenJMS by default defines the following: (QueueConnectionFactory is not defined by default!)
    queueName = "queue1"
    queueConnectionFactoryName = "JmsQueueConnectionFactory"
    The creation of the initial context could be done like this
    Hashtable env = new Hashtable ();
    env.put(Context.PROVIDER_URL,
    "rmi://localhost:1099/JndiServer");
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.exolab.jms.jndi.rmi.RmiJndiInitialContextFactory");
    jndiContext = new InitialContext (env);
    Similar modifications are needed for JBoss

  • Error while deploying WDJ code

    Hi All,
    I am getting the following error while deploying WDJ code in NWDS .
    1 . The project was not built due to classpath errors (incomplete or involved in cycle).
    2 .  Missing required library: 'com.sap.security.api.jar'.
    I have put the jar file into the project path but still then i am getting these errors . Please help .
    Thanks in advance,

    Hi,
    If u are using simple project then then adding jar into application property would do but if using DC then u must follow below procedure.
    You cant just add any external jar file into a DC project.
    There is only one way to add a external jar file is by using external library project.
    1.create an external library project type DC.
    2. put your external jar file into its lib folder.
    3. create its public part of type SDA( Assembly if using CE)...and API( Compilation if using CE).
    4. just use SDA public part into your webdynpro project as used DC.
    5. and when you deploy your webdynpro project on server, this file will also get deployed... remember to use SDA public part..
    Regards
    Surender Dahiya

  • Java run time error while executing JavaFX code

    Hi
    I copied the code from [http://java.sun.com/javafx/1/tutorials/ui/overview/UIControls.fx|http://java.sun.com/javafx/1/tutorials/ui/overview/UIControls.fx] while
    reading in [http://java.sun.com/javafx/1/tutorials/ui/overview/#controls|http://java.sun.com/javafx/1/tutorials/ui/overview/#controls] tutorial and paste it to my
    netbeans editor but i got following error.
    init:
    deps-jar:
    compile:
    jar:
    standard-run:
    # An unexpected error has been detected by Java Runtime Environment:
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d94513f, pid=5152, tid=5996
    # Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
    # Problematic frame:
    # V  [jvm.dll+0xd513f]
    # An error report file with more information is saved as hs_err_pid5152.log
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    BUILD FAILED (total time: 18 seconds)can anyone tell whether its netbeans fault or javaFX. I am using netbeans 6.5.1 on windows vista. I have added following plugin in netbeans for javaFX
    *JavaFX Kit
    *JavaFX SDK for Windows
    is anyone also getting this error for this code and have solution for this.

    You are correct the crash is causing due to ToggleButton and ProgessBar. the code is correct because i tried it on eclipse 3.4 and it worked fine.This is definitely netbeans error. because its giving error even if u try to execute javafx code with just one ToggleButton or ProgressBar. I tried the following simple code in netbeans 6.5
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.control.ToggleButton;
    import javafx.scene.control.ProgressBar;
    var toggle=ToggleButton {
                    translateX:50
                    translateY:50
                    text: "First"
                    width:100
                    height:20
    var progress= ProgressBar {
            progress: bind ProgressBar.computeProgress( 100, 30 )
    Stage {
        title : "Toggle Button Test"
        scene: Scene {
            width: 200
            height: 200
            content: [ toggle
    } When i just added toggle button to contents then button showed up in window but on clicking it window disappear and compiler gave crash error on the other hand when i added just progess bar it just throws the error.The same code is running fine on eclipse
    Is there any workaround in netbeans for this if its a bug and if not what should i do to correct it.

  • The document could not be saved. The server said: "The operation failed because an unexpected error occurred. (Result code 0×80020005)" Please ensure you have completed all required properties with the correct information and try again.

    I am having problems  saving documents back to SharePoint when any of the document properties (metadata columns) are set to be "managed metadata". The check-in/save fails with error:
    The document could not be saved. The server said:
    “The operation failed because an unexpected error occurred. (Result code 0×80020005)”
    Please ensure you have completed all required properties with the correct information and try again.
    I have seen similar threads that suggest this is a known issue with this version of Acrobat but I would like conformation from Adobe that this is a known issue and whether it is fixed in a newer version?
    Adobe Acrobat version 10.1.13
    SharePoint 2010

    Hi quodd,,
    We are sorry for the issue being faced by you. I need some information from you so that I take further steps:
    1. Which Adobe product are you using Acrobat or Adobe reader- what is the complete version?
    2. How are you opening and saving the PDF, the exact workflow?
         Are you doing it from within Adobe Reader/Acrobat application or opening it from browser, doing changes and saving it using browser itself.
    3. Can you try to save a PDF to library with Custom template and managed metadata columns using browser directly.
    4. Please verify that columns name do not contain spaces or some other special characters.
       Can you try to save PDF to library with Custom template and just a single managed metadata column  with a simple name
    Thanks,
    Nikhil Gupta

  • RMI Client Code Issue

    Hello,
    Here is my client side RMI program:
    import java.rmi.*;
    public class MyRemoteClient {
    public static void main(String args[]) {
    MyRemoteClient mm = new MyRemoteClient();
    mm.go();
    public void go(){
    try{
    MyRemote service2 = (MyRemote) Naming.lookup("rmi://xxx.xxx.xx.xx/Hello");
    String s = service2.sayHello();
    System.out.println(s);
    } catch(Exception ex){ex.printStackTrace();}
    }Having started RMI Registry and Service Implementor code on the server, if I try to run the above code on the client it fire the following error:
    java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at MyRemoteImpl_Stub.sayHello(Unknown Source)
    at MyRemoteClient.go(MyRemoteClient.java:11)
    at MyRemoteClient.main(MyRemoteClient.java:6)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
    ... 7 more
    I am wondering as to why is it trying to connect to a local host 127.0.1.1 instead of the IP Address specified at by"xxx.xx.xx.xx" in the program?
    I have the stub class and the service interface classes on my client-side.
    Thanks.

    I am wondering as to why is it trying to connect to a
    local host 127.0.1.1 instead of the IP Address
    specified at by"xxx.xx.xx.xx" in the program?Because that only specifies where the lookup should be done, i.e. where the Registry is. This lookup() returns a stub to your remote object which has its own IP address and port embedded into it, and that's where 127.0.0.1 is coming from - you're not doing Registry.lookup at this point, you're calling your remote method.
    This indicates a DNS or /etc/hosts misconfiguration - your primary IP address is coming up as 127.0.0.1 instead of whatever your public IP address is. Famous Linux issue. You should really fix it in your DNS or /etc/hosts, but you can work around it by setting -Djava.rmi.server.hostname=<public IP address> at the server JVM.

  • XML simple code help

    Hello Everyone, I am learning XML and I'm trying to make a simple code that will display three different messages on a separate line. I already have the code but there is something that does not let it work. Please if somebody can take a quick look at the code and tell me what should I do in order to get it working. Thanks in advance
    This is my simplerequestdata.xml
    {<root>
    <message1>This</message1>
    <message2>Technology</message2>
    <message3>Is confusing</message3>
    </root>}
    This is my xmlrequest.html code
    {<html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript">
    var req=null;
    function xhr(){
    try
    { // Firefox, Opera 8.0+, Safari
    req=new XMLHttpRequest();
    catch (e)
    // Internet Explorer
    try
    req=new ActiveXObject("Msxml2.XMLHTTP");
    catch (e)
    req=new ActiveXObject("Microsoft.XMLHTTP");
    return req;
    function getData(){
    req = new xhr();
    req.open("get","simpleRequestData.xml");
    req.send(null);
    if(req.readyState==4){
    if(req.status==200){
    var doc = req.responseXML;
    var msgNodes = doc.documentElement.getElementsByTagName('message');
    var msgDiv = document.getElementById("message");
    var msg = document.createElement("message");
    msg.innerHTML = msgNodes[0].firstChild.nodeValue + "<br />" + msgNodes[1].firstChild.nodeValue + '
    ' + msgNodes[2].firstChild.nodeValue;
    msgDiv.innerHTML = '';
    msgDiv.appendChild(msg);
    </script>
    <style>
    #message{color:red;}
    message{display:block;color:green;}
    </style>
    </head>
    <body>
    <form>
    <input type="button" onclick="getData()" value="Get Message"/>
    <div id="message">Message Goes Here</div>
    </form>
    </body>
    </html>
    }

    That looks like Javascript to me. This forum is about Java and XML, not Javascript and XML. However the error is pretty obvious:
    var msgNodes = doc.documentElement.getElementsByTagName('message');You don't have any elements named "message" in that XML document. You have an element named "message1" and an element named "message2" and an element named "message3", but no "message" elements. So you get a list of zero elements there. You need to rewrite your DOM-handling code to reflect the actual input.

  • Overwriting framework error messages of simple types

    Hi
    Is it possible to overwrite the framework error messages of simple types? For example: Instead of "Enter the value in the format -2,733.34" we prefer something like "Enter the percent value in the format 0.00 to 100." or "Enter a correct percent value.".
    Use case: We use for the most input fields for any numbers (telefon, amount, age, ...) the simple type "decimal", this offers following advantages:
    - optional use (and framework validation) of fraction digits
    - the input field has no default value (integer/long/short writes as default "0" to the input field, that is in most cases - for example post/zip code - not useful)
    Otherwise decimal simple types has the disadvantage, that if the user write any letters in the (decimal) input field, the error message is as described above and so not very helpful too.
    Thanks in advance
    Stefan

    Hi Stefan
    Unfortunately seems no way to customize the error messages.
    1. If the standard numeric simple type does not suit your needs, theoretically you can try to override the Java class of the standard type and add your custom messages/logic. For example, for Integer this is DdTypeInteger & DdTypeInt. Methods you need to override is format(...) and parse(...). After this in controller's code you should create a new attribute and provide your own custom type as input parameter.
    I never tried this way
    2. You can make the attribute as Calculated. Then in getter/setter you should put your custom formatting/parsing logic.
    BR, Siarhei

  • Still having probs running simple code in SE8

    I copied a very simple code into SE8 and compiled it. Please find folowing the code and the output:
    package average2;
        import java.text.DecimalFormat;
        import java.swing.JOptionPane;
    public class Main {
        public Main() {
        public static void main( String args[] )
                int total;          // sum of grades
                int gradeCounter;   // number of grades entered
                int grade;          // grade value
                double average;     // number with decimal point for average
                String gradeString; // grade typed by user
                // initialisation
                total = 0;          // initialise total
                gradeCounter = 0;   // initialise gradeCounter
                // processing phase
                // get first grade from user
                gradeString = JOptionPane.showInputDialogue( "Enter Student Grade or -1 to Quit:" );
                // convert gradeString to int
                grade = Integer.parseInt( gradeString );
                // loop until sentinal value is reached
                while ( grade != -1 ) {
                    total = total + grade;          // add grade to tatal
                gradeCounter = gradeCounter + 1;    // increment counter
                // get next grade from user
                gradeString = JOptionPane.showInputDialogue( "Enter Student Grade or -1 to Quit:" );
                // convert gradeStrin to int
                grade = Integer.parseInt( gradeString );
            }   // end while
                // termination phase
                DecimalFormat twoDigits = new DecimalFormat( "0.00" );
                // if user entered at leat one grade...
                if( gradeCounter != 0 ) {
                    // calculate average of all grades entered
                    average = (double) total / gradeCounter;
                    // display average with two digits of precision
                    JOptionPane.showMessageDialog( null, "Class average is "
                            + twoDigits.format( average ), "Class Average",
                            JOptionPane.INFORMATION_MESSAGE );
                } // end 'if' part of if...else
                else // if no grades entered, output appropriate message
                    JOptionPane.showMessageDialog( null, "No grades were entered",
                            "Class Average", JOptionPane.cINFORMATION_MESSAGE );
                System.exit( 0 );
        } // end main
        }  // end class averageHere is the resulting output:
    init:
    deps-jar:
    Compiling 1 source file to C:\Java\Average2\build\classes
    C:\Java\Average2\src\average2\Main.java:10: illegal start of expression
    public static void main( String args[] )
    C:\Java\Average2\src\average2\Main.java:73: ';' expected
    } // end main
    C:\Java\Average2\src\average2\Main.java:75: '}' expected
    } // end class average
    3 errors
    BUILD FAILED (total time: 2 seconds).
    Can anyone tell me what I'm doing wrong?
    Thanks in advance

    Hmmm, I put the } in at the end of the code and that got rid of one of the bugs. code now reads:
    package average2;
        import java.text.DecimalFormat;
        import java.swing.JOptionPane;
    public class Main {
        public Main() {
        public static void main( String args[] )
                int total;          // sum of grades
                int gradeCounter;   // number of grades entered
                int grade;          // grade value
                double average;     // number with decimal point for average
                String gradeString; // grade typed by user
                // initialisation
                total = 0;          // initialise total
                gradeCounter = 0;   // initialise gradeCounter
                // processing phase
                // get first grade from user
                gradeString = JOptionPane.showInputDialog( "Enter Student Grade or -1 to Quit:" );
                // convert gradeString to int
                grade = Integer.parseInt( gradeString );
                // loop until sentinal value is reached
                while ( grade != -1 ) {
                    total = total + grade;          // add grade to tatal
                gradeCounter = gradeCounter + 1;    // increment counter
                // get next grade from user
                gradeString = JOptionPane.showInputDialog( "Enter Student Grade or -1 to Quit:" );
                // convert gradeStrin to int
                grade = Integer.parseInt( gradeString );
            }   // end while
                // termination phase
                DecimalFormat twoDigits = new DecimalFormat( "0.00" );
                // if user entered at leat one grade...
                if( gradeCounter != 0 ) {
                    // calculate average of all grades entered
                    average = (double) total / gradeCounter;
                    // display average with two digits of precision
                    JOptionPane.showMessageDialog( null, "Class average is "
                            + twoDigits.format( average ), "Class Average",
                            JOptionPane.INFORMATION_MESSAGE );
                } // end 'if' part of if...else
                else // if no grades entered, output appropriate message
                    JOptionPane.showMessageDialog( null, "No grades were entered",
                            "Class Average", JOptionPane.INFORMATION_MESSAGE );
                System.exit( 0 );
        } // end void main
        } // end main
    //} // end class mainWith the following output:
    init:
    deps-jar:
    Compiling 1 source file to C:\Java\Average2\build\classes
    C:\Java\Average2\src\average2\Main.java:10: illegal start of expression
    public static void main( String args[] )
    C:\Java\Average2\src\average2\Main.java:73: ';' expected
    } // end void main
    2 errors
    BUILD FAILED (total time: 0 seconds)
    I'm really sorry for being stupid. I'm just trying to understand what is going wrong. As soon as I get this sorted I can apply the principle to all other code I'm trying to write. I copied this code directly from my textbook used the SDK. Netbeans dosen't seem to like the way the textbook writes the code!

  • Error when executing Java code, java.lang.NoClassFoundError:

    Hi, I am new learner in Java Programming and I am using J2SDK and notepad to write a code. I don't have problem in compiling using javac filename, however I received an error when executing using java filename.
    The error message I got is Exception in thread "main" java.lang.NoClassDefFoundError: Hello/jawa.
    I have verified this simple code - Hello has no issue but somehow it does not run. I even try to compile and execute in other computer also the similiar error returned.
    My Client Platform is Windows XP Professional.
    I would appreciate any expert can help to suggest me the knowledge/solution to fix this kind of error. Thanks
    Jackie

    It looks like you entered the command "java Hello.java" or "java Hello/java" (I assumed 'jawa' was a typo.)
    You should have entered "java Hello" if your class name is Hello. I am guessing that Hello.java is probably the source code file name. The argument to the java command is the fully qualified class name. "java Hello.java" tells the java command to look for a class named java that is in the Hello package.

  • An error occurred while exporting code metrics

    In the function of Calculate Code Metrics for Solution,
    a error occurred when I click "Open List in Microsoft Excel" then show a dialog that "An error occurred while exporting code metrics" 
    But the code metrics result is calculated correctly
    It can open correctly a few day ago

    Hi happybai,
    Which VS version did you use? I test it in my VS2013 version, it works well.
    If you test the same project in other VS machine, how about the result? If it works well in other VS machine, we could make sure that it is not your project issue. Maybe you could create a simple app, test it again.
    If all projects have the same issue, I doubt that it is your VS IDE issue.
    Please make sure that you install the latest update package for your VS, like sp1 for VS2010, update 4 for VS2013 or other, of course, you would think about your current VS version.
    Please also make sure that it is not your Excel issue, for example, please make sure that you could open an excel file in your windows.
    You'd better run your VS in safe mode to make sure that it is not the VS add-ins or extension tools' issue.
    https://msdn.microsoft.com/en-us/library/ms241278.aspx
    Anyway, we need to make sure that whether it is the project or the VS IDE issue or others firstly.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or

    I have taken the cfdump for tmpqry and it shows all data for
    the range ( No error at this step ) . But when we exceute this
    dbquery we get below mentioned error .
    <cfquery name="qry" dbtype="query" >
    SELECT *
    FROM tmpqry
    ORDER BY #arguments.colSort# ASC
    </cfquery>
    senerio:
    I am using createobject to create a reference for component
    and call MDArraySort function in the cfc and getting this error .
    'The system has attempted to use an undefined value, which
    usually indicates a programming error, either in your code or some
    system code.
    Null pointer is undefined.... '
    i am using this code in a cfc file.
    <cffunction name="MDArraySort" Returntype="query"
    access="public" >
    <cfargument name="colArray" type="array"
    required="true">
    <cfargument name="colNames" type="string"
    required="true">
    <cfargument name="colSort" type="string"
    required="true">
    <cfargument name="sensorIDs" type="string"
    required="true">
    <cfscript>
    var tmpqry = Querynew(arguments.colNames);
    var qRow = QueryAddRow(tmpqry, Arraylen(arguments.colArray)
    </cfscript>
    <cfloop from="1" to="#Arraylen(arguments.colArray)#"
    index="qRowIndex">
    <cfscript>
    sIndexinSensorIDs = colArray[qRowIndex]["SENSOR"]&"##";
    Temp_readin_code =
    colArray[qRowIndex]["READING_CODE"]&"##";
    QuerySetCell(tmpqry, 'SENSOR', sIndexinSensorIDs,
    qRowIndex);
    QuerySetCell(tmpqry,
    'TYPE',javacast('String',colArray[qRowIndex]["TYPE"]), qRowIndex);
    QuerySetCell(tmpqry, 'TIMESTAMP2',
    LSParseDateTime(colArray[qRowIndex]["TIMESTAMP2"]), qRowIndex);
    QuerySetCell(tmpqry,
    'ORDER_BY_PARAM',javacast('String',colArray[qRowIndex]["ORDER_BY_PARAM"]),
    qRowIndex);
    QuerySetCell(tmpqry, 'READING_CODE',Temp_readin_code ,
    qRowIndex);
    QuerySetCell(tmpqry,
    'READING',javacast('String',colArray[qRowIndex]["READING"]),
    qRowIndex);
    QuerySetCell(tmpqry,
    'PK_READING',javacast('String',colArray[qRowIndex]["PK_READING"]),
    qRowIndex);
    QuerySetCell(tmpqry,
    'ALARM_STATUS',javacast('String',colArray[qRowIndex]["ALARM_STATUS"]),
    qRowIndex);
    QuerySetCell(tmpqry, 'DURATION',
    javacast('String',colArray[qRowIndex]["DURATION"]), qRowIndex);
    QuerySetCell(tmpqry,
    'DESCRIPTION',javacast('String',colArray[qRowIndex]["DESCRIPTION"]),
    qRowIndex);
    </cfscript>
    </cfloop>
    <cfquery name="qry" dbtype="query" >
    SELECT *
    FROM tmpqry
    ORDER BY #arguments.colSort# ASC
    </cfquery>
    <cfreturn qry >
    </cffunction>
    It is working fine for some date range and and getting above
    mentioned error in sone situation .

    Hi All ,
    Thank you for your support ,
    Finally i have fix the issue using some changes in my
    function in cfc .
    <cffunction name="MDArraySort" Returntype="query"
    access="public" >
    <cfargument name="colArray" type="array"
    required="true">
    <cfargument name="colNames" type="string"
    required="true">
    <cfargument name="colSort" type="string"
    required="true">
    <cfargument name="sensorIDs" type="string"
    required="true">
    <cfscript>
    //Declare variable collection used in function as local
    --->
    var tmpqry =
    Querynew(arguments.colNames,"CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_DATE,CF_SQL_VARCHAR,CF_ SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR");
    var qRow = QueryAddRow(tmpqry,
    Arraylen(arguments.colArray));
    </cfscript>
    <cfloop from="1" to="#Arraylen(arguments.colArray)#"
    index="qRowIndex">
    <cfscript>
    // Populate the query table
    QuerySetCell(tmpqry, 'SENSOR',
    colArray[qRowIndex]["SENSOR"], qRowIndex);
    QuerySetCell(tmpqry,
    'TYPE',arguments.colArray[qRowIndex]["TYPE"], qRowIndex);
    QuerySetCell(tmpqry, 'TIMESTAMP2',
    LSParseDateTime(arguments.colArray[qRowIndex]["TIMESTAMP2"]),
    qRowIndex);
    QuerySetCell(tmpqry,
    'ORDER_BY_PARAM',arguments.colArray[qRowIndex]["ORDER_BY_PARAM"],
    qRowIndex);
    QuerySetCell(tmpqry, 'READING_CODE',
    colArray[qRowIndex]["READING_CODE"] , qRowIndex);
    QuerySetCell(tmpqry,
    'READING',arguments.colArray[qRowIndex]["READING"], qRowIndex);
    QuerySetCell(tmpqry,
    'PK_READING',arguments.colArray[qRowIndex]["PK_READING"],
    qRowIndex);
    QuerySetCell(tmpqry,
    'ALARM_STATUS',arguments.colArray[qRowIndex]["ALARM_STATUS"],
    qRowIndex);
    QuerySetCell(tmpqry, 'DURATION',
    arguments.colArray[qRowIndex]["DURATION"], qRowIndex);
    QuerySetCell(tmpqry,
    'DESCRIPTION',arguments.colArray[qRowIndex]["DESCRIPTION"],
    qRowIndex);
    </cfscript>
    </cfloop>
    <cfquery name="qry" dbtype="query" >
    SELECT *
    FROM tmpqry
    ORDER BY #arguments.colSort# ASC
    </cfquery>
    <cfreturn qry >
    </cffunction>
    Rajesh
    SCMS
    India

  • Error while running transaction code f-42

    hi all,
    i am getting an error while running t code F-42.
    Error is 'Global Number Parameter Is Missing'.
    Please solve this
    Thanks in Advance

    Hi,
    Check Global parameters settings at OBY6.
    Thanks!
    Assign points
    Zia

Maybe you are looking for

  • Oracle Portal DADs

    Hi everybody, Here is my configuration: SERVER1 : Oracle Application Server 10gR2 1.0.1.4 (Infrastructure and Portal & Wireless) for portal development. SERVER2 : An Oracle Database Server 10gR2 My question: How can I use SERVER2 Database Schemas as

  • Problems installing Photoshop Elements 11 upgrade

    I'm trying to install photoshop elements 11 and premiere elements as an upgrade from elements 6. When I click on 'download' on the order page the next screen tells me that I'm using internet explorer 4 or earlier and have to use a later version.  My

  • Possible? access data from another effects plugin

    right this sounds complicated so I'm gonna ask if its even possible before i start trying to build this. Picture this scenario. Main comp has layer "A" which is a sub-composition, B. The layer A has my filter on it. In comp B, we have a layer "C" wit

  • Iterator in swing

    is it possible to use an iterator in the actionclass? im sure you are but for some reason i get the compile error: SoftwareHouseFrame.java:567: cannot resolve symbol symbol  : class Iterator location: class SoftwareHouseFrame.ApplicationDisplayStaff

  • CProjects- Customizing New Status in "Change Status"

    I need to customize new status in "Change Status" drop down of cProjects tool. Now the status available are "Created, Released, Locked etc" as we all know. But i need to customize my own status for "Projects Phases and Tasks" I create. Can i do that.