Compiles but does not execute as expected????

Here is my code. I can compile and execute but does not perform as expected What do I need to change?
import java.io.;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.NumberFormat;
import java.math.*;
public class CalcTest extends JFrame implements ActionListener, ItemListener
public JMenuBar createMenuBar()
        JMenuBar mnuBar = new JMenuBar();
        setJMenuBar(mnuBar);
            //Create File & add Exit
        JMenu mnuFile = new JMenu("File", true);
        mnuFile.setMnemonic(KeyEvent.VK_F);
        mnuFile.setDisplayedMnemonicIndex(0);
        mnuBar.add(mnuFile);
        JMenuItem mnuFileExit = new JMenuItem("Exit");
        mnuFileExit.setMnemonic(KeyEvent.VK_F);
        mnuFileExit.setDisplayedMnemonicIndex(1);
        mnuFile.add(mnuFileExit);
        mnuFileExit.setActionCommand("Exit");
        mnuFileExit.addActionListener(this);
        JMenu mnuFunction = new JMenu("Function", true);
        mnuFunction.setMnemonic(KeyEvent.VK_F);
        mnuFunction.setDisplayedMnemonicIndex(0);
        mnuBar.add(mnuFunction);
       JMenuItem mnuFunctionClear = new JMenuItem("Clear");
       mnuFunctionClear.setMnemonic(KeyEvent.VK_F);
       mnuFunctionClear.setDisplayedMnemonicIndex(1);
       mnuFunction.add(mnuFunctionClear);
       mnuFunctionClear.setActionCommand("Clear");
       mnuFunctionClear.addActionListener(this);
        // Fields for Principle 
  JPanel row1 = new JPanel();
  JLabel dollar = new JLabel("How much are you borrowing?"); 
  JTextField money = new JTextField("", 15);
        // Fields for Term and Rate
   JPanel row2 = new JPanel();
   JLabel choice = new JLabel("Select Year & Rate:");
   JCheckBox altchoice = new JCheckBox("Alt. Method");
   JTextField YR = new JTextField("", 4);
   JTextField RT = new JTextField("", 4);
       //Jcombobox R=rate,Y=year
   String[] RY =  {   
        "7 years at 5.35%", "15 years at 5.5 %", "30 years at 5.75%", " "  
  JComboBox mortgage = new JComboBox(RY);
            // Fields for Payment   
    JPanel row3 = new JPanel(); 
    JLabel payment = new JLabel("Your monthly payment will be:");
    JTextField owe = new JTextField(" ", 15); 
          //Scroll Pane and Text Area
   JPanel row4 = new JPanel();
   JLabel amortization = new JLabel("Amortization:");
   JTextArea chart = new JTextArea(" ", 7, 22); 
   JScrollPane scroll = new JScrollPane(chart, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,  
                                           JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);  
    StringBuffer amt = new StringBuffer();
    Container pane = getContentPane(); 
    FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
    JButton Cal = new JButton("Calculate"); 
    NumberFormat currency = NumberFormat.getCurrencyInstance();  
  public CalcTest() 
           // Title and Exit of JFrame  
     super("Mortgage and Amortization Calculator"); 
     setSize(475, 328);  
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            //JFrame layout      
     pane.setLayout(flow);     
           //Input output fields added to JFrame  
     row1.add(dollar);    
     row1.add(money);   
     pane.add(row1);    
     mortgage.setSelectedIndex(3);   
     mortgage.addActionListener(this);    
     mortgage.setActionCommand("mortgage");
     row2.add(altchoice);     
     altchoice.addItemListener(this);  
     row2.add(choice);     
     YR.setEditable(false);    
     RT.setEditable(false);     
     row2.add(YR);     
     row2.add(RT);      
     row2.add(mortgage);    
     pane.add(row2);     
     row3.add(payment);   
     row3.add(owe);       
     pane.add(row3);      
     owe.setEditable(false);  
             //Scroll Pane added to JFrame     
      row4.add(amortization);      
      chart.setEditable(false); 
      row4.add(scroll);   
      pane.add(row4);     
            //Executable Button- Clear,Exit, Calculate 
      JPanel row5 = new JPanel();
      JButton clear = new JButton("Clear");  
      clear.addActionListener(this);     
      row5.add(clear); 
      pane.add(row5); 
      JButton exit = new JButton("Exit"); 
      exit.addActionListener(this);    
      row5.add(exit);      
      Cal.setEnabled(false);  
      Cal.addActionListener(this); 
      row5.add(Cal);       
      pane.add(row5);   
      setContentPane(pane);   
      setVisible(true); 
  }                    //End of constructor   
    private void calculate()
      String loanAmount = money.getText(); 
         if(loanAmount.equals(""))      
           return;      
           double P = Double.parseDouble(loanAmount);     
           int y;     
           double r;    
         if(altchoice.isSelected())   
          if(YR.getText().equals("") || RT.getText().equals(""))  
             return;        
           y = Integer.parseInt(YR.getText());     
            r = Double.parseDouble(RT.getText());   
           else     
              int index = mortgage.getSelectedIndex();  
              if(index == 3)         
              return;          
              int[] terms = { 7, 15, 30 };     
              double[] rates = { 5.5, 5.35, 5.75 }; 
              y = terms[index];  
              r = rates[index];  
              double In = r / (100 * 12.0);  
              double M = P * (In / (1 - Math.pow(In + 1, -12.0 * y)));
              owe.setText(currency.format(M));      
                     //Column Titles for Text Area     
       chart.setText("Pmt#\tPrincipal\tInterest\tBalance\n");  
     for (int i = 0; i < y * 12; i++)     
  {            double interestAccrued = P * In;     
               double principalPaid = M - interestAccrued;          
               chart.append(i + 1 + "\t" + currency.format(principalPaid)           
                                + "\t" + currency.format(interestAccrued)     
                                      + "\t" + currency.format(P) + "\n");      
                P = P + interestAccrued - M;   
     public void itemStateChanged(ItemEvent ie) 
  {        int status = ie.getStateChange();    
       if (status == ItemEvent.SELECTED)     
           mortgage.setEnabled(false);  
           YR.setEditable(true); 
           RT.setEditable(true);   
           Cal.setEnabled(true);  
        else 
        mortgage.setEnabled(true); 
        YR.setEditable(false);    
        RT.setEditable(false);     
       Cal.setEnabled(false);     
  public void actionPerformed(ActionEvent ae)//Calculations and Button executions
      String command = ae.getActionCommand();  
              // Exit program      
       if (command.equals("Exit"))   
        System.exit(0);
              // Cal button 
      if (command.equals("Calculate") || command.equals("mortgage")) 
          calculate();      
             // Clear fields  
      if (command.equals("Clear")) 
         money.setText(null);
         mortgage.setSelectedIndex(3); 
         owe.setText(null);   
         chart.setText(null); 
}             //End actionPerformed 
   public static void main(String args[]) throws IOException
           new CalcTest();
[/Code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Here is the code again
import java.io.;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.NumberFormat;
import java.math.*;
public class CalcTest extends JFrame implements ActionListener, ItemListener
public JMenuBar createMenuBar()
        JMenuBar mnuBar = new JMenuBar();
        setJMenuBar(mnuBar);
            //Create File & add Exit
        JMenu mnuFile = new JMenu("File", true);
        mnuFile.setMnemonic(KeyEvent.VK_F);
        mnuFile.setDisplayedMnemonicIndex(0);
        mnuBar.add(mnuFile);
        JMenuItem mnuFileExit = new JMenuItem("Exit");
        mnuFileExit.setMnemonic(KeyEvent.VK_F);
        mnuFileExit.setDisplayedMnemonicIndex(1);
        mnuFile.add(mnuFileExit);
        mnuFileExit.setActionCommand("Exit");
        mnuFileExit.addActionListener(this);
        JMenu mnuFunction = new JMenu("Function", true);
        mnuFunction.setMnemonic(KeyEvent.VK_F);
        mnuFunction.setDisplayedMnemonicIndex(0);
        mnuBar.add(mnuFunction);
       JMenuItem mnuFunctionClear = new JMenuItem("Clear");
       mnuFunctionClear.setMnemonic(KeyEvent.VK_F);
       mnuFunctionClear.setDisplayedMnemonicIndex(1);
       mnuFunction.add(mnuFunctionClear);
       mnuFunctionClear.setActionCommand("Clear");
       mnuFunctionClear.addActionListener(this);
        // Fields for Principle 
  JPanel row1 = new JPanel();
  JLabel dollar = new JLabel("How much are you borrowing?"); 
  JTextField money = new JTextField("", 15);
        // Fields for Term and Rate
   JPanel row2 = new JPanel();
   JLabel choice = new JLabel("Select Year & Rate:");
   JCheckBox altchoice = new JCheckBox("Alt. Method");
   JTextField YR = new JTextField("", 4);
   JTextField RT = new JTextField("", 4);
       //Jcombobox R=rate,Y=year
   String[] RY =  {   
        "7 years at 5.35%", "15 years at 5.5 %", "30 years at 5.75%", " "  
  JComboBox mortgage = new JComboBox(RY);
            // Fields for Payment   
    JPanel row3 = new JPanel(); 
    JLabel payment = new JLabel("Your monthly payment will be:");
    JTextField owe = new JTextField(" ", 15); 
          //Scroll Pane and Text Area
   JPanel row4 = new JPanel();
   JLabel amortization = new JLabel("Amortization:");
   JTextArea chart = new JTextArea(" ", 7, 22); 
   JScrollPane scroll = new JScrollPane(chart, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,  
                                           JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);  
    StringBuffer amt = new StringBuffer();
    Container pane = getContentPane(); 
    FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
    JButton Cal = new JButton("Calculate"); 
    NumberFormat currency = NumberFormat.getCurrencyInstance();  
  public CalcTest() 
           // Title and Exit of JFrame  
     super("Mortgage and Amortization Calculator"); 
     setSize(475, 328);  
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
            //JFrame layout      
     pane.setLayout(flow);     
           //Input output fields added to JFrame  
     row1.add(dollar);    
     row1.add(money);   
     pane.add(row1);    
     mortgage.setSelectedIndex(3);   
     mortgage.addActionListener(this);    
     mortgage.setActionCommand("mortgage");
     row2.add(altchoice);     
     altchoice.addItemListener(this);  
     row2.add(choice);     
     YR.setEditable(false);    
     RT.setEditable(false);     
     row2.add(YR);     
     row2.add(RT);      
     row2.add(mortgage);    
     pane.add(row2);     
     row3.add(payment);   
     row3.add(owe);       
     pane.add(row3);      
     owe.setEditable(false);  
             //Scroll Pane added to JFrame     
      row4.add(amortization);      
      chart.setEditable(false); 
      row4.add(scroll);   
      pane.add(row4);     
            //Executable Button- Clear,Exit, Calculate 
      JPanel row5 = new JPanel();
      JButton clear = new JButton("Clear");  
      clear.addActionListener(this);     
      row5.add(clear); 
      pane.add(row5); 
      JButton exit = new JButton("Exit"); 
      exit.addActionListener(this);    
      row5.add(exit);      
      Cal.setEnabled(false);  
      Cal.addActionListener(this); 
      row5.add(Cal);       
      pane.add(row5);   
      setContentPane(pane);   
      setVisible(true); 
  }                    //End of constructor   
    private void calculate()
      String loanAmount = money.getText(); 
         if(loanAmount.equals(""))      
           return;      
           double P = Double.parseDouble(loanAmount);     
           int y;     
           double r;    
         if(altchoice.isSelected())   
          if(YR.getText().equals("") || RT.getText().equals(""))  
             return;        
           y = Integer.parseInt(YR.getText());     
            r = Double.parseDouble(RT.getText());   
           else     
              int index = mortgage.getSelectedIndex();  
              if(index == 3)         
              return;          
              int[] terms = { 7, 15, 30 };     
              double[] rates = { 5.5, 5.35, 5.75 }; 
              y = terms[index];  
              r = rates[index];  
              double In = r / (100 * 12.0);  
              double M = P * (In / (1 - Math.pow(In + 1, -12.0 * y)));
              owe.setText(currency.format(M));      
                     //Column Titles for Text Area     
       chart.setText("Pmt#\tPrincipal\tInterest\tBalance\n");  
     for (int i = 0; i < y * 12; i++)     
  {            double interestAccrued = P * In;     
               double principalPaid = M - interestAccrued;          
               chart.append(i + 1 + "\t" + currency.format(principalPaid)           
                                + "\t" + currency.format(interestAccrued)     
                                      + "\t" + currency.format(P) + "\n");      
                P = P + interestAccrued - M;   
     public void itemStateChanged(ItemEvent ie) 
  {        int status = ie.getStateChange();    
       if (status == ItemEvent.SELECTED)     
           mortgage.setEnabled(false);  
           YR.setEditable(true); 
           RT.setEditable(true);   
           Cal.setEnabled(true);  
        else 
        mortgage.setEnabled(true); 
        YR.setEditable(false);    
        RT.setEditable(false);     
       Cal.setEnabled(false);     
  public void actionPerformed(ActionEvent ae)//Calculations and Button executions
      String command = ae.getActionCommand();  
              // Exit program      
       if (command.equals("Exit"))   
        System.exit(0);
              // Cal button 
      if (command.equals("Calculate") || command.equals("mortgage")) 
          calculate();      
             // Clear fields  
      if (command.equals("Clear")) 
         money.setText(null);
         mortgage.setSelectedIndex(3); 
         owe.setText(null);   
         chart.setText(null); 
}             //End actionPerformed 
   public static void main(String args[]) throws IOException
           new CalcTest();

Similar Messages

  • Servleto compiles but does not execute

    I have a problem with servlets about allocation memory, i have installed tomcat 5.0, j2sdk 1.4, servlets compile is good, but when i try to call them it cause the next error
    All this happen after reinstall again j2sdk and tomcat, please help me, any ideas
    2006-09-14 21:51:59 StandardWrapperValve[srvltSEGRPT023]: Excepci�n de reserva de espacio para servlet srvltSEGRPT023
    javax.servlet.ServletException: Error reservando espacio para una instancia de servlet
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:691)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Unknown Source)
    ----- Root Cause -----
    java.lang.NoClassDefFoundError: Illegal name: SEGUROS/Servlets/srvltSEGRPT023
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
         at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:964)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:687)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Unknown Source)

    http://forum.java.sun.com/thread.jspa?threadID=544602&messageID=2650499
    http://www.jchq.net/discus/messages/50028/51378.html?1109907530
    You need to replace the "/" slashes with "." dots for the class loader to find the class file.

  • Applet compiles but does not appear...

    the applet compiles but does not appear :(
    all that appears is a blank box...hopefully someone can help
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class program2 extends Applet implements ActionListener
         private Button btLeft, btRight, btUp, btDown, btBgYellow,
         btBgRed, btBgBlue, btBgOrange, btTxtRed,btTxtYellow, btTxtBlue,
         btTxtOrange, btFtHel, btFtCr, btFtTr, btFtSy;
         private MessagePanel messagePanel;
         private Panel p = new Panel();
         public void init()
              p.setLayout(new BorderLayout());
              messagePanel = new MessagePanel("Java is Life");
              messagePanel.setBackground(Color.white);
              //directional buttons
              Panel pButtons = new Panel();
              pButtons.setLayout(new FlowLayout());
              pButtons.add(btLeft = new Button());
              pButtons.add(btRight = new Button());
              pButtons.add(btUp = new Button());
              pButtons.add(btDown = new Button());
              //Background buttons
              Panel BgButtons = new Panel();
              BgButtons.setLayout(new FlowLayout());
              BgButtons.add(btBgRed = new Button());
              btBgRed.setBackground(Color.red);
              BgButtons.add(btBgYellow = new Button());
              btBgYellow.setBackground(Color.yellow);
              BgButtons.add(btBgBlue = new Button());
              btBgBlue.setBackground(Color.blue);
              BgButtons.add(btBgOrange = new Button());
              btBgOrange.setBackground(Color.orange);
              //text color buttons
              Panel txtButtons = new Panel();
              txtButtons.setLayout(new GridLayout(4,1));
              txtButtons.add(btTxtRed = new Button());
              btTxtRed.setBackground(Color.red);
              txtButtons.add(btTxtYellow = new Button());
              btTxtYellow.setBackground(Color.yellow);
              txtButtons.add(btTxtBlue = new Button());
              btTxtBlue.setBackground(Color.blue);
              txtButtons.add(btTxtOrange = new Button());
              btTxtOrange.setBackground(Color.orange);
              //font buttons
              Panel ftButtons = new Panel();
              ftButtons.setLayout(new GridLayout(4,1));
              ftButtons.add(btFtHel = new Button());
              ftButtons.add(btFtCr = new Button());
              ftButtons.add(btFtTr = new Button());
              ftButtons.add(btFtSy = new Button());
              //layout
              p.add(messagePanel, BorderLayout.CENTER);//set center 1st
              p.add(pButtons, BorderLayout.SOUTH);
              p.add(BgButtons, BorderLayout.NORTH);
              p.add(txtButtons, BorderLayout.EAST);
              p.add(ftButtons, BorderLayout.WEST);
              //listeners
              btLeft.addActionListener(this);
              btRight.addActionListener(this);
              btUp.addActionListener(this);
              btDown.addActionListener(this);
              btBgRed.addActionListener(this);
              btBgYellow.addActionListener(this);
              btBgBlue.addActionListener(this);
              btBgOrange.addActionListener(this);
              btTxtRed.addActionListener(this);
              btTxtYellow.addActionListener(this);
              btTxtBlue.addActionListener(this);
              btTxtOrange.addActionListener(this);
              btFtHel.addActionListener(this);
              btFtCr.addActionListener(this);
              btFtTr.addActionListener(this);
              btFtSy.addActionListener(this);
         //implement listener
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == btLeft)
                   left();
              else if(e.getSource() == btRight)
                   right();
              else if(e.getSource() == btUp)
                   up();
              else if(e.getSource() == btDown)
                   down();
              else if(e.getSource() == btBgRed)
                   red();
              else if(e.getSource() == btBgYellow)
                   yellow();
              else if(e.getSource() == btBgBlue)
                   blue();
              else if(e.getSource() == btBgOrange)
                   orange();
              else if(e.getSource() == btTxtRed)
                   redText();
              else if(e.getSource() == btTxtYellow)
                   yellowText();
              else if(e.getSource() == btTxtBlue)
                   blueText();
              else if(e.getSource() == btTxtOrange)
                   orangeText();
              else if(e.getSource() == btFtHel)
                   helvetica();
              else if(e.getSource() == btFtCr)
                   courier();
              else if(e.getSource() == btFtTr)
                   times();
              else if(e.getSource() == btFtSy)
                   symbol();
         //directional methods :0)
         private void left()
              int x = messagePanel.getXCoordinate();
              if(x > 10)
                   messagePanel.setXCoordinate(x - 10);
                   messagePanel.repaint();
         private void right()
              int x = messagePanel.getXCoordinate();
              if(x < (getSize().width - 5))
                   messagePanel.setXCoordinate(x + 5);
                   messagePanel.repaint();
         private void up()
              int y = messagePanel.getYCoordinate();
              if(y < (getSize().height - 10))
                   messagePanel.setYCoordinate(y - 10);
                   messagePanel.repaint();
         private void down()
              int y = messagePanel.getYCoordinate();
              if(y < (getSize().height + 10))
                   messagePanel.setYCoordinate(y + 10);
                   messagePanel.repaint();
         //background methods :)
         private void red()
              messagePanel.setBackground(Color.red);
         private void yellow()
              messagePanel.setBackground(Color.yellow);
         private void blue()
              messagePanel.setBackground(Color.blue);
         private void orange()
              messagePanel.setBackground(Color.orange);
         //text color methods :)
         private void redText()
              messagePanel.setForeground(Color.red);
         private void yellowText()
              messagePanel.setForeground(Color.yellow);
         private void blueText()
              messagePanel.setForeground(Color.blue);
         private void orangeText()
              messagePanel.setForeground(Color.orange);
         private void helvetica()
              Font myfont = new Font("Helvetica", Font.PLAIN,12);
              messagePanel.setFont(myfont);
         private void courier()
              Font myfont = new Font("Courier", Font.PLAIN,12);
              messagePanel.setFont(myfont);
         private void times()
              Font myfont = new Font("TimesRoman", Font.PLAIN,12);
              messagePanel.setFont(myfont);
         private void symbol()
              Font myfont = new Font("Symbol", Font.PLAIN,12);
              messagePanel.setFont(myfont);

    You add everything to the Panel p but you never add that panel to the applet. What you probably want is to add everything to the applet. An applet is a special kind of panel so you can just change "p" to "this" everywhere in init and remove the declaration of p at the top.

  • Program compiles, but does not run

    To: XCode Users <[email protected]>
    From: Brigit Ananya <[email protected]>
    Subject: Program compiles, but does not run
    I am trying to port a Java application from the PC to the Mac. I am using XCode and the program compiles, but it does not run.
    When I try to run the ...app, I get the message that the main class is not specified, etc.
    When I try to run the ...jar, I do not get the message that the main class is not specified, but I do get the message that there is no Manifest section for bouncycastle, etc.
    Here are the detailed messages I get in the Console when I try to run the program:
    When I try to run the ...app, I get the following message:
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] [LaunchRunner Error] No main class specified
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] [JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] Exception in thread "main" java.lang.NullPointerException
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] at apple.launcher.LaunchRunner.run(LaunchRunner.java:112)
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52)
    When I try to run the ...jar, I do get the following message:
    1/9/09 7:22:43 AM [0x0-0x8d08d].com.apple.JarLauncher[2262] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] Exception in thread "main"
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] java.lang.SecurityException: no manifiest section for signature file entry org/bouncycastle/asn1/DEREnumerated.class
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:377)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:231)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:176)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarVerifier.processEntry(JarVerifier.java:233)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarVerifier.update(JarVerifier.java:188)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarFile.initializeVerifier(JarFile.java:325)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarFile.getInputStream(JarFile.java:390)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.URLClassPath$JarLoader$1.getInputStream(URLClassPath.java:620)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.Resource.cachedInputStream(Resource.java:58)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.Resource.getByteBuffer(Resource.java:113)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader.defineClass(URLClassLoader.java:249)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.security.AccessController.doPrivileged(Native Method)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    I do specify the main class in both, the Manifest file and the Info.plist file, in the correct way, "package.MainClass". Is there another place where I need to specify it?
    Why do I need org/bouncycastle/asn1/DEREnumerated.class, and how would I have to specify it in Manifest?
    I also posted these questions at Mac Programming at forums.macrumors.com and at Xcode-users Mailing List at lists.apple.com/mailman/listinfo, but I did not get any answer.
    Please help! Thanks!

    There was something wrong with my Info.plist file.
    So, here is my corrected Info.plist file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
         <key>CFBundleDevelopmentRegion</key>
         <string>English</string>
         <key>CFBundleExecutable</key>
         <string>AnanyaCurves</string>
         <key>CFBundleGetInfoString</key>
         <string></string>
         <key>CFBundleIconFile</key>
         <string>AnanyaCurves.icns</string>
         <key>CFBundleIdentifier</key>
         <string>com.AnanyaSystems.AnanyaCurves</string>
         <key>CFBundleInfoDictionaryVersion</key>
         <string>6.0</string>
         <key>CFBundleName</key>
         <string>AnanyaCurves</string>
         <key>CFBundlePackageType</key>
         <string>APPL</string>
         <key>CFBundleShortVersionString</key>
         <string>0.1</string>
         <key>CFBundleSignature</key>
         <string>ac</string>
         <key>CFBundleVersion</key>
         <string>0.1</string>
         <key>Java</key>
         <dict>
              <key>JMVersion<key>
              <string>1.4+</string>
              <key>MainClass</key>
              <string>AnanyaCurves</string>
              <key>VMOptions</key>
              <string>-Xmx512m</string>
              <key>Properties</key>
              <dict>
                   <key>apple.laf.useScreenMenuBar</key>
                   <string>true</string>
                   <key>apple.awt.showGrowBox</key>
          <string>true</string>
              </dict>
         </dict>
    </dict>
    </plist>Ok, so now I can at least run the AnanyaCurves.jar file by double-clicking on it.
    However, I still cannot run the AnanyaCurves.app file. When I double-click on it, I get the following message in the Console:
    1/11/09 5:12:26 PM [0x0-0x67067].com.apple.JarLauncher[1128]  at ananyacurves.AnanyaCurves.main(AnanyaCurves.java:1961)
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] [JavaAppLauncher Error] CFBundleCopyResourceURL() failed loading MRJApp.properties file
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] [LaunchRunner Error] No main class specified
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] [JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] Exception in thread "main" java.lang.NullPointerException
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137]  at apple.launcher.LaunchRunner.run(LaunchRunner.java:112)
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137]  at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137]  at apple.launcher.JavaApplicationLauncher.main(JavaApplicationLauncher.java:61)Why is it looking for the MRJApp.properties file? Isn't this outdated? Shouldn't it look for the Info.plist file? I do not have a MRJApp.properties file.
    Also, in the Run menu of my XCode project, Go, Run, and Debug are disabled, but perhaps this has to do with not being able to run the AnanyaCurves.app file.
    Thanks for your time! I really appreciate any help you can give me!

  • Tcode opens selection screen, but does not executes the program

    Hi!
    tcode opens selection screen of a custom program, but it seems that it does not executes the program itself.
    Sounds strange, but how to explain this if I can run a program manually with no problem and it displays result screen, but when I try to run the program with tcode - it opens selection screen but program quits before displaying result screen. I was putting a breakpoint at the begining of the program - it does not triggers debuger when running a tcode (it triggers debugger if to run program manually).... any ideas?
    Help will be appreciated,
    Mindaugas

    Are you using this???
          SET PARAMETER ID '80B' FIELD T_TABLE-OPBEL.
          CALL TRANSACTION 'FPE3' AND SKIP FIRST SCREEN.
    That way it should work....
    Greetings,
    Blag.

  • This program is well compiled but does not work.

    I would like to know why this program does not work properly:
    the idea is :
    1. the user introduces a text as a string
    2.the progam creates a file (with a FileOutputStream)
    3. then this file is encripted according to DES (using JCE, cipheroutputStream)
    4.the new filw is an encripte file, whose content is introduced in a string (with a FileInputStream)
    (gives no probles of compilation!!)
    (don know why it does not work)
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.io.*;
    import java.security.*;
    import javax.crypto.*;
    public class cuadro extends Applet{
         private TextArea area1 =new TextArea(5,50);
         private TextArea area2 =new TextArea(5,50);
         private Button encriptar=new Button("encriptar");
         private Button decriptar=new Button("decriptar");
         public cuadro(){
              layoutApplet();
              encriptar.addActionListener(new ButtonHandler());
              decriptar.addActionListener(new ButtonHandler());
              resize(400,400);
              private void layoutApplet(){
              Panel keyPanel = new Panel();
              keyPanel.add(encriptar);
              keyPanel.add(decriptar);
              Panel textPanel = new Panel();
              Panel texto1 = new Panel();
              Panel texto2 = new Panel();
              texto1.add(new Label("               plain text"));
              texto1.add(area1);
              texto2.add(new Label("               cipher text"));
              texto2.add(area2);
              textPanel.setLayout(new GridLayout(2,1));
              textPanel.add(texto1);
              textPanel.add(texto2);
              setLayout(new BorderLayout());
              add("North", keyPanel);
              add("Center", textPanel);
              public static String encriptar(String text1){
              //generar una clave
              SecretKey clave=null;
              String text2="";
              try{
              FileOutputStream fs =new FileOutputStream ("c:/javasoft/ti.txt");
              DataOutputStream es= new DataOutputStream(fs);
                   for(int i=0;i<text1.length();++i){
                        int j=text1.charAt(i);
                        es.write(j);
                   es.close();
              }catch(IOException e){
                   System.out.println("no funciona escritura");
              }catch(SecurityException e){
                   System.out.println("el fichero existe pero es un directorio");
              try{
                   //existe archivo DESkey.ser?
                   ObjectInputStream claveFich =new ObjectInputStream(new FileInputStream ("DESKey.ser"));
                   clave = (SecretKey) claveFich.readObject();
                   claveFich.close();
              }catch(FileNotFoundException e){
                   System.out.println("creando DESkey.ser");
                   //si no, generar generar y guardar clave nueva
              try{
                   KeyGenerator claveGen = KeyGenerator.getInstance("DES");
                   clave= claveGen.generateKey();
                   ObjectOutputStream claveFich = new ObjectOutputStream(new FileOutputStream("DESKey.ser"));
                   claveFich.writeObject(clave);
                   claveFich.close();
              }catch(NoSuchAlgorithmException ex){
                   System.out.println("DES key Generator no encontrado.");
                   System.exit(0);
              }catch(IOException ex){
                   System.out.println("error al salvar la clave");
                   System.exit(0);
         }catch(Exception e){
              System.out.println("error leyendo clave");
              System.exit(0);
         //crear una cifra
         Cipher cifra = null;
         try{
              cifra= Cipher.getInstance("DES/ECB/PKCS5Padding");
              cifra.init(Cipher.ENCRYPT_MODE,clave);
         }catch(InvalidKeyException e){
              System.out.println("clave no valida");
              System.exit(0);
         }catch(Exception e){
              System.out.println("error creando cifra");
              System.exit(0);
         //leer y encriptar el archivo
         try{
              DataInputStream in = new DataInputStream(new FileInputStream("c:/javasoft/ti.txt"));
              CipherOutputStream out = new CipherOutputStream(new DataOutputStream(new FileOutputStream("c:/javasoft/t.txt")),cifra);
              int i;
              do{
                   i=in.read();
                   if(i!=-1) out.write(i);
              }while (i!=-1);
              in.close();
              out.close();
         }catch(IOException e){
              System.out.println("error en lectura y encriptacion");
              System.exit(0);
         try{
              FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
              DataInputStream le =new DataInputStream(fe);
                   int i;
                   char c;
                   do{
                        i=le.read();
                        c= (char)i;
                        if(i!=-1){
                        text2 += text2.valueOf(c);
                   }while(i!=-1);
                        le.close();
              /*}catch(FileNotFoundException e){
                   System.out.println("fichero no encontrado");
                   System.exit(0);
              }catch(ClassNotFoundException e){
                   System.out.println("clase no encontrada");
                   System.exit(0);
              */}catch(IOException e){
                   System.out.println("error e/s");
                   System.exit(0);
              return text2;
         class ButtonHandler implements ActionListener{
         public void actionPerformed(ActionEvent e){
              try{
              if (e.getActionCommand().equals(encriptar.getLabel()))
                   //     area2.setText(t1)
                   area2.setText(encriptar(area1.getText()));
                   //area2.setText("escribe algo");
                   else if (e.getActionCommand().equals(decriptar.getLabel()))
                        System.out.println("esto es decriptar");
                        //area2.setText("hola");
         }catch(Exception ex){
              System.out.println("error en motor de encriptacion");
                   //else System.out.println("no coge el boton encriptado/decript");

    If you don't require your code to run as an applet, you will probably get more mileage from refactoring it to run as an application.
    As sudha_mp implied, an unsigned applet will fail on the line
    FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
    due to security restrictions. (Which, incidentally, are there for a very good reason)

  • This Formula(Function) compiles but does not display any result

    Please can anybody help me resolve this issue.The code below is a code for a formula(function) column in oracle report, i have complied this code and it successfully complied but it does not display any result for the column having a stock balance in the entire report.
    function CF_STOCK_BALFormula return Number is
         v_all_positive NUMBER;
         v_all_negative NUMBER;
    begin
         IF :transaction_type IN ('RECEIPT', 'RETURN') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal + :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal + :quantity;
              END IF;
         ELSIF :transaction_type IN ('ISSUE') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal - :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal - :quantity;
              END IF;
         END IF;
    RETURN (:cp_stock_bal);
    end;
    Edited by: Gbenga on Jan 17, 2012 11:30 PM

    Please can anybody help me resolve this issue.The code below is a code for a formula(function) column in oracle report, i have complied this code and it successfully complied but it does not display any result for the column having a stock balance in the entire report.
    function CF_STOCK_BALFormula return Number is
         v_all_positive NUMBER;
         v_all_negative NUMBER;
    begin
         IF :transaction_type IN ('RECEIPT', 'RETURN') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal + :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal + :quantity;
              END IF;
         ELSIF :transaction_type IN ('ISSUE') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal - :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal - :quantity;
              END IF;
         END IF;
    RETURN (:cp_stock_bal);
    end;
    Edited by: Gbenga on Jan 17, 2012 11:30 PM

  • Compiles Fine, but Does Not Execute

    I'm using jdk 1.3.1 since that is what my school uses.
    This program is really simple, the user is supposed to pick a type of variable then put data that is valid for that data type, and if they're wrong the catch numberformatexception would tell them. I've looked at the code for awhile, its not the best but I dont see why it doesn't run maybe someone could scan through the code and see if something stands out. I know its annoying when someone posts their entire programs code but since I have no idea where my problem is help would be most appreciated.
    * In The Lab 1
    * Using switch and try Blocks
    * Programmed by: Andy Kovacs
    import java.io.*;
    public class InTheLab
        public static void main(String[] args) throws IOException
            BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
            //Variables
            String strChoice;
            int intChoice;
            String strString;
            String strInteger;
            String strDouble;
            double dblDouble;
            int intInteger;
            boolean done = false;
            //Loop so program doesn't end before user is finished
            while(!done)
                try
                    strChoice = dataIn.readLine();
                    intChoice = Integer.parseInt(strChoice);
                    //Makes sure the user selects 1-4
                    if (intChoice >= 5 || intChoice <=0)
                        System.out.println("Invalid Selection");
                        throw new NumberFormatException();
                    System.out.println("What's My Type?");
                    System.out.println("");
                    System.out.println("1) String");
                    System.out.println("2) Int");
                    System.out.println("3) Double");
                    System.out.println("4) Quit the program");
                    String strHeader;
                    switch(intChoice)
                        case 1:
                            System.out.println("Insert Data That Would Be Valid For String Data");
                            strString = dataIn.readLine();
                            System.out.println("Your are correct, as any input can be saved as a string.");
                            break;
                        case 2:
                            System.out.println("Insert Data That Would Be Valid For Integer Data");
                            strInteger = dataIn.readLine();
                            intInteger = Integer.parseInt(strInteger);
                            System.out.println("You are correct, as Integers are any whole numbers.");
                            break;
                        case 3:
                            System.out.println("Insert Data That Would Be Valid For Double Data");
                            strDouble = dataIn.readLine();
                            dblDouble = Double.parseDouble(strDouble);
                            System.out.println("You are correct, any number up to 14 or 15 decimal places are valid for Double Data");
                            break;
                        case 4:
                            done = true;
                            System.out.println("Closing program");
                            break;
                        default:
                            throw new NumberFormatException();
                catch (NumberFormatException e)
                System.out.println("Your Response was not a valid number or answer.");
                System.out.println("Please reenter your selection.");
    }

    I am using version 1.4, and your code executes on my
    machine.
    What happens when you try it on your machine? An
    exception?
    Nothing? You might get rid of the "throws
    IOException"
    from main's signature and see if that helps... I seem
    to
    remember that the exception list was part of the
    signature,
    though I might be in error there.It isn't. There is nothing wrong with have exception specification on the main method.

  • Applet Servlet communication compiles but does not communicate

    Hi,
    I have a applet which has a button named A. By clicking the button, the applet passes the letter A to the servlet. The servlet in turn accesses an Oracle database and retrieves the name corresponding to letter A from a table (name is Andy in the present case). The servlet interacts with the databse via a simple stored procedure and uses its output parameter to display the name Andy back in the applet.
    Both the applet and servlet codes have compiled fine(servlet code compiled with -classpath option to servlet jar using a TOMCAT). However, on clicking button A in the applet, I do not get the name Andy.
    Any help/suggestion in resolution of this is highly appreciated. Thanks in advance.
    HTML CODE:
    <html>
    <center>
    <applet code = "NameApplet.class" width = "600" height = "400">
    </applet>
    </center>
    </html>
    STORED PROCEDURE CODE:
    procedure get_letter_description(
    ac_letter IN CHAR,
    as_letter_description OUT VARCHAR2) IS
    BEGIN
    SELECT letter_description INTO as_letter_description FROM letter WHERE letter =
    ac_letter;
    EXCEPTION
    WHEN no_data_found THEN as_letter_description := 'No description available';
    END get_letter_description;
    APPLET CODE:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    public class NameApplet extends Applet implements ActionListener
    private TextField text;
    private Button button1;
    private String webServerStr = null;
    private String hostName = "localhost";
         private int port = 8080;
    private String servletPath = "/examples/servlet/NameServlet?letter=";
    private String letter;
    public void init()
         button1 = new Button("A");
    button1.addActionListener(this);
    add(button1);
              text = new TextField(20);
         add(text);
    // get the host name and port of the applet's web server
              URL hostURL = getCodeBase();
         hostName = hostURL.getHost();
    port = hostURL.getPort();
              webServerStr = "http://" + hostName + ":" + port + servletPath;
    public void actionPerformed(ActionEvent e)
         if (e.getSource() == button1)
         letter = "" + 'A';
    private String getName(String letter){
    String name = "" ;
    try {
              URL u = new URL(webServerStr + letter);
              Object content = u.getContent();
    name = content.toString();
         } catch (Exception e) {
         System.err.println("Error in getting name");
    return name;
    SERVLET CODE:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import java.util.Properties;
    public class NameAppletServlet extends HttpServlet {
    private static Connection conn = null;
    private static final char DEFAULT_CHAR = 'A';
    private static final char MIN_CHAR = 'A';
    private static final char MAX_CHAR = 'G';
    private static final String PROCEDURE_CALL
    = "{call get_letter_description(?, ?)}";
    protected void doGet( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    handleHttpRequest(request, response);
    protected void doPost( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    handleHttpRequest(request, response);
    protected void handleHttpRequest( HttpServletRequest request,
    HttpServletResponse response )
    throws ServletException, IOException
    String phrase = null;
    char letter = getLetter(request, DEFAULT_CHAR);
    if (letter >= MIN_CHAR && letter <= MAX_CHAR) {
    try {
    name = getName(conn, letter);
    } catch (SQLException se) {
    String msg = "Unable to retrieve name from database.";
    name = msg;
    } else {
    String msg = "Invalid letter '" + letter + "' requested.";
    //throw new ServletException(msg);
    phrase = msg;
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();
    out.println(name);
    private String getName(Connection conn, char letter)
    throws SQLException
    CallableStatement cstmt = conn.prepareCall(PROCEDURE_CALL);
    cstmt.setString(1, String.valueOf(letter));
    cstmt.registerOutParameter(2, Types.VARCHAR);
    cstmt.execute();
    String name = cstmt.getString(2);
    cstmt.close();
    return name;
    private char getLetter(HttpServletRequest request, char defaultLetter) {
    char letter = defaultLetter;
    String letterString = request.getParameter("letter");
    if (letterString!=null) {
    letter = letterString.charAt(0);
    return letter;
    public void init(ServletConfig conf) throws ServletException {
    super.init(conf);
    String dbPropertyFile = getInitParameter("db.property.file");
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection(
    "jdbc:oracle:thin:myserver:1521:CDD",
    "scott",
    "tiger");
    } catch (IOException ioe) {
    throw new ServletException(
    "Unable to init ReinforcementServlet: " + ioe.toString());
    } catch (ClassNotFoundException cnfe) {
    throw new ServletException(
    "Unable to init ReinforcementServlet. Could not find driver: "
    + cnfe.toString());
    } catch (SQLException se) {
    throw new ServletException(
    "Unable to init ReinforcementServlet. Error establishing"
    + " database connection: " + se.toString());
    }

    Hi,
    I am not able to understand by which method you are doing Applet-Servlet commuincation.
    If you want to use Object Serialization method, plz.get the details from following URL.
    http://www.j-nine.com/pubs/applet2servlet/
    Ajay

  • I downloaded the trial version of Lightroom.  The file downloaded but does not execute

    I downloaded CreativeCloudSetup.exe.  I clicked on the the file but nothing happens.  My Task Manager shows that the file is in memory but not doing anything.

    Valenta3630 then the next step will be to review your installation log files for the error message preventing the Creative Cloud Desktop application from installing on your computer.  For information on how to locate and interpret your installation log files please see Troubleshoot install issues with log files | CC - http://helpx.adobe.com/creative-cloud/kb/troubleshoot-install-logs-cc.html.  You are welcome to post any specific errors you discover to this discussion.

  • Deferred Event Subscription Processed but does not execute PL/SQL Rule Func

    Greetings all,
    I am creating a simple Business Event Subscription w/ a PL/SQL Rule Function in my 11.5.10.CU2/10gR2 E-Business Suite environment. My custom code simply inserts a record into a custom table. When I setup the Subscription to run synchronously (i.e. Phase < 100), the PL/SQL function executes and a record is inserted into my custom table. When I setup the Subscription to run in a deferred manner (i.e. Phase Code >= 100), no record is inserted into my custom table.
    The Service Component "Workflow Deferred Agent Listener" is running. A close inspection of the WF_DEFERRED queue tables reveal that the message/entry is being processed (I can see the status change from READY to PROCESSED), but the PL/SQL function is never executed.
    I would prefer to setup the Subscription to be deferred in order not to degrade performance of the user's session that triggers the business process. What am I missing?
    Thanks,
    Jeff

    Jeff,
    If you are using global variables in your custom code to insert, you may want to stop and start the WF agent listener and then try firing the event.
    Thanks
    Nagamohan

  • PS3 droplet called from command line in XP reads in files but does not execute action

    Hello.
    I am a researcher interested in anxiety disorders in young children. As part of a functional magnetic resonace brain imaging study we need to compare children's responses to familiar and unfamiliar faces. The latter are no problem, but for the former we need to take pictures of the children's mothers and process them "on the fly" so that they can be incorporated into stimulus sets presented in the MRI machine (otherwise known as the "magnet").
    For presentation in the magnet, the images have to be in a particular format. I have created an action that produces the appropriate format, and a PS3 droplet that behaves appropriately (outputs correctly modified files to the stated address) when a Windows XP (SP3) folder is dropped on it.
    However, I need to automate the procedure further because it will be executed by individuals with little or no understanding of PS etc.
    It occurred to me that I could call my droplet from the XP command line with the folder containing the relevant files as an argument (and then I would be able to incorporate this function into an overall control program).
    However, I have found that this approach loads the relevant files into CS3, but that the actions don't run.
    I would very much appreciate any help with this problem.
    Thank you.
    Adrian Angold.

    A command line script might work, but would lack a user interface. Error
    processing and logging capabilities would also be limited.
    I would consider writing a small application in a language such as Visual
    Basic or C# that uses Photoshop's automation interface. The automation SDK
    is provided on the Photoshop DvD.

  • The ANE library is compiled to MacOS, but does not compile on Windows.

    ANE lbrary FPHockeyApp http://flashpress.ru/blog/contents/ane/hockeyapp/FPHockeyApp-6.1.ane
    Application:
    package
        import flash.display.Sprite;
        import ru.flashpress.hockeyapp.FPHockeyApp;
        import ru.flashpress.hockeyapp.ns.haIOS;
        public class TestHockeyApp extends Sprite
            public function TestHockeyApp()
                super();
                use namespace haIOS;
                var APP_ID:String = 'you app id';
                FPHockeyApp.manager.configureWithIdentifier(APP_ID);
                FPHockeyApp.manager.startManager();
                FPHockeyApp.manager.authenticator.authenticateInstallation();
    Compiled in MacOS, but does not compile on Windows:
    Why so?

    Windows 64-bit.
    On a single MacBookPro installed OSX and Windows(not virtual).

  • TS1559 I have 4s. After I updated ios7.0.3 my wifi is geyed out. I expected after ios7.0.4 update wifi will work again, but does not. It annoying, because I have to use my data... Does anyone know when it will be fixed or does anyone have the same problem

    I have 4s. After I updated ios7.0.3 my wifi is geyed out. I expected after ios7.0.4 update wifi will work again, but does not. It annoying, because I have to use my data... Does anyone know when it will be fixed or does anyone have the same problem?

    I have the same problem.  After the upgrade, my wifi is greyed out, and the battery won't hold a charge long. I reset all the settings, tried all the things suggested by Apple, but it didn't work.  I took the phone to Verizon, but they said they can't fix it, go to Apple
    I made an appointment at the Genius bar, where the staff was incredibly rude and dismissive. A representative told me that the wi-fi is broken and I would need to buy a new phone for $200, because mine is out of warranty. I'm due for an upgrade in a few months, so I'm not going to pay $200 for another 4S now.  I'm also not going to buy any more Apple products.  Their upgrade caused this problem, and they are not standing behind their producet.

  • Windows xp runs java application but does not compile it - urgent please

    Hi
    My new PC(portable) does not compile my java progran:
    'javac' is not recognized as an internal or external command, operatable program or batch file.
    If you have any suggestion, please let me know!
    Aria

    Thanks anyhow;
    The following information is sent to beginners site.
    I have talked to british, belgian and others regarding this problem. They said it is very expensive and we laughed.
    Hi,
    Windows XP runs java application but does not compile it. I get following message:
    'javac' is not recognized as an internal or external command, operatable program or batch file.
    MS-DOS does not exists but a command line edits autoexec.nt having allinformation regarding installed jdk5. I run my java applicat
    ion from here. But no compilation.
    Environment variables has following information.
    JAVA_HOME C:\jdk5.0
    CLASSPATH C:\jdk5.0\myPrograms
    path %JAVA_HOME%bin
    All information in autoexec.nt exists as windows 98 and I run it from command line.
    Would you please tell me what is wrong?
    Thanks
    Aria

Maybe you are looking for

  • Installed additional RAM but computer performanc​e now worse

    Can anybody please help? I have a T61 that came with 2Gb RAM (1GB + 1GB) and I recently purchased another 2GB chip. The problem is that after installation I had a total RAM of 3GB (1GB + 2GB), the Windows Experience Index score actually decreased!  I

  • ITunes download error on the iPad

    I bought some videos on iTunes (episodes of 2 TV seasons). Most everything downloaded with no problems but there are 7 that didn't complete and show up on the iTunes download page as "Download error. Tap to retry." If I follow the directions and tap,

  • Error opening document

    Could not complete your request because the file is not compatible with this version of Photoshop. I received this error when I opened a document I created in CS6 and went to edit it. I also tried to open it in CS5 with the same result. Any ideas?

  • How can you downgrade from ios 7.1.2 to 6.1.3

    hello everyone can you please help me i need to downgrade from ios 7.1.2 to ios6.1.3 because my ipad dosent work realy well with it can you plese help me  

  • Lightroom to Photoshop and back question

    When I export a photo from Lightroom into Photoshop, I make my edits, and then I select save.  In Photoshop the photo changes to a psd file as it should.  But when I go back into Lightroom, the photo does not appear in the original folder it was sent