Simple Java Bank Program

Can anyone please help?
I am looking for a very simple client/server banking Java Application that performs basic function such as view account balance, and being able to deposit and withdraw money from the account.
Any help would be much appreciated!

You are asking for an application. I don't think anyone will ever start an open source banking system, because only banks will have an interest in them and they will develop their systems in-house.
Sorry dude, but you'll have to switch on that brain of yours and do the work yourself.

Similar Messages

  • Simple Java 3D program’s CPU Usage spikes to up to 90 percent!

    Hi, everyone. I’m completely new to Java 3D and I’m toying around with basic program structure right now. My code is based off of that in the first chapter on 3D in Killer Game Programming in Java. I removed most of the scene elements, replacing them with a simple grid, Maya style. (Yes, I’m starting off small, but my ambitions are grand – I intend on creating a polygonal modeling and animation toolset. After all, the Maya PLE is dead – damn you, Autodesk! – and I just plain dislike Blender.) I implement a simple OrbitBehavior as a means for the user to navigate the scene. That part was basically copy and paste from Andrew Davison’s code. The mystery, then, is why the program’s framerate drops below 1 FPS and its CPU Usage spikes to up to 90 percent, according to the Task Manager, when I tumble the scene. I’d appreciate anyone taking the time to look at the code and trying to identify the problem area. (I’ve undoubtedly missed something totally newbish. -.-) Thank you!
    (Also, I had the worst possible time wrestling with the posting process. Is anyone else having trouble editing their posts before submitting them?)
    import java.awt.*;
    import javax.swing.*;
    public class MAFrame
        public static final Dimension SCREEN_SIZE = Toolkit.getDefaultToolkit().getScreenSize();
        public MAFrame ()
            System.out.println("Initializing...");
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception e) {
                e.printStackTrace();
            JFrame frame = new JFrame ("Modeling and Animation");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            MAViewPanel panel = new MAViewPanel ();
            frame.getContentPane().add(panel);
            frame.pack();       
            frame.setLocation(((int)SCREEN_SIZE.getWidth() / 2) - (frame.getWidth() / 2),
                              ((int)SCREEN_SIZE.getHeight() / 2) - (frame.getHeight() / 2));     
            frame.setVisible(true);
    import com.sun.j3d.utils.behaviors.vp.*;
    import com.sun.j3d.utils.geometry.*;
    import com.sun.j3d.utils.universe.*;
    import java.awt.*;
    import javax.media.j3d.*;
    import javax.swing.*;
    import javax.vecmath.*;
    public class MAViewPanel extends JPanel
        public static final int GRID_SIZE = 12;
        public static final int GRID_SPACING = 4;
        public BoundingSphere bounds;
        public BranchGroup sceneBG;
        public SimpleUniverse su;
        public MAViewPanel ()
            GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
            Canvas3D canvas3D = new Canvas3D (config);               
            canvas3D.setSize(600, 600);
            add(canvas3D);
            canvas3D.setFocusable(true);
            canvas3D.requestFocus();
            su = new SimpleUniverse (canvas3D);
            createSceneGraph();
            initUserPosition();
            orbitControls(canvas3D);
            su.addBranchGraph(sceneBG);
        public void createSceneGraph ()
            sceneBG = new BranchGroup ();
            bounds = new BoundingSphere (new Point3d(0, 0, 0), 1000);
            // ambient light
            Color3f white = new Color3f (1.0f, 1.0f, 1.0f);
            AmbientLight ambientLight = new AmbientLight (white);
            ambientLight.setInfluencingBounds(bounds);
            sceneBG.addChild(ambientLight);
            // background
            Background background = new Background ();
            background.setColor(0.17f, 0.65f, 0.92f);
            background.setApplicationBounds(bounds);       
            sceneBG.addChild(background);
            // grid
            createGrid();
            sceneBG.compile();
        public void createGrid ()
            Shape3D grid = new Shape3D();
            LineArray lineArr = new LineArray (GRID_SIZE * 8 + 4, GeometryArray.COORDINATES);
            int offset = GRID_SIZE * GRID_SPACING;
            // both sides of the grid plus the middle, done for both directions at once (each line defined by two points)
            for (int count = 0, index = 0; count < GRID_SIZE * 2 + 1; count++) {
                // vertical, left to right
                lineArr.setCoordinate(index++, new Point3d (-offset + (count * GRID_SPACING), 0, offset));  // starts near
                lineArr.setCoordinate(index++, new Point3d (-offset + (count * GRID_SPACING), 0, -offset)); // ends far
                // horizontal, near to far
                lineArr.setCoordinate(index++, new Point3d (-offset, 0, offset - (count * GRID_SPACING))); // starts left
                lineArr.setCoordinate(index++, new Point3d (offset, 0, offset - (count * GRID_SPACING)));  // ends right
            grid.setGeometry(lineArr);
            sceneBG.addChild(grid);
        public void initUserPosition ()
            ViewingPlatform vp = su.getViewingPlatform();
            TransformGroup tg = vp.getViewPlatformTransform();
            Transform3D t3d = new Transform3D ();
            tg.getTransform(t3d);
            t3d.lookAt(new Point3d (0, 60, 80), new Point3d (0, 0, 0), new Vector3d(0, 1, 0));
            t3d.invert();
            tg.setTransform(t3d);
            su.getViewer().getView().setBackClipDistance(100);
        private void orbitControls (Canvas3D c)
            OrbitBehavior orbit = new OrbitBehavior (c, OrbitBehavior.REVERSE_ALL);
            orbit.setSchedulingBounds(bounds);
            ViewingPlatform vp = su.getViewingPlatform();
            vp.setViewPlatformBehavior(orbit);     
    }

    Huh. A simple call to View.setMinimumFrameCycleTime() fixed the problem. How odd that there effectively is no default maximum framerate. Of course simple programs like these, rendered as many times as possible every second, are going to consume all possible CPU usage...

  • How to run the simple java card program in eclipse?

    I am trying to run a simple HelloWorld program in eclipse 3.5 having java card development kit 2.2 installed in it.
    Firstly,I go to the JCWDE tab and press start..then when trying to deploy that package its giving me error like " com.hw.HelloWorld: unsupported class file format of version 50.0." can any one help me in this what is this error???n how to resolve n run this program..

    Hi,
    It is because the converter works on byte code and it only supports a subset of the Java language (see the JC specifications). It is kind of like compiling you code on Java 6 and trying to run it on Java 5. The JCDK outlines the required compiler version.
    Cheers,
    Shane

  • Simple Java Mail program

    Hi, i have written a simple code to send mail thru java... but it doesnt work... control never comes back after stepping in to the send function.. no exceptions.. no mails sent.. nothin.. cud someone hel me out??
    sometimes i get this exception after a long time:
    javax.mail.MessagingException: Exception reading response;
    nested exception is:
         java.net.SocketException: Connection reset
         at com.sun.mail.smtp.SMTPTransport.readServerResponse(Unknown Source)
         at com.sun.mail.smtp.SMTPTransport.openServer(Unknown Source)
         at com.sun.mail.smtp.SMTPTransport.protocolConnect(Unknown Source)
         at javax.mail.Service.connect(Unknown Source)
    here is the code snippet:
    public void mySend() throws Throwable
    Properties p = System.getProperties();
    p.put("mail.transport.protocol", "smtp");
    p.put("mail.smtp.host", "smtp.gmail.com");
    p.put("mail.smtp.port", "465");
    p.put("mail.smtp.starttls.enable", "true");
    p.put("mail.smtp.auth", "true");
    Authenticator authenticator = new Authenticator()
    protected PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication("vicky.bhandari", "password");
    Session session = Session.getInstance(p, authenticator);
    SMTPMessage message = new SMTPMessage(session);
    InternetAddress fromAddress = new InternetAddress("[email protected]");
    InternetAddress toAddress = new InternetAddress("[email protected]");
    message.setSubject("Test");
    message.addRecipient(Message.RecipientType.TO, toAddress);
    message.setFrom(fromAddress);
    SMTPTransport.send(message);
    Could someone please help me out??

    Hey,
    Im currently having problems with the code below:
    public class SendMail {
         private static final String SMTP_HOST_NAME = "smtp.gmail.com";
         private static final String SMTP_AUTH_USER = "[email protected]";
         private static final String SMTP_AUTH_PWD = "**************";
         public void sendMail(String recipients[ ], String subject, String message , String from) throws MessagingException{
         boolean debug = false;
              Properties props = System.getProperties();
              props.put("mail.transport.protocol", "smtp");
              props.put("mail.smtp.host", SMTP_HOST_NAME);
              props.put("mail.smtp.port", "465");
              props.put("mail.smtp.starttls.enable", "true");
              props.put("mail.smtp.auth", "true");
              Authenticator auth = new SMTPAuthenticator();               
              Session session = Session.getDefaultInstance(props, auth);
              session.setDebug(debug);
              Message msg = new MimeMessage(session);
              InternetAddress addressFrom = new InternetAddress(from);
              msg.setFrom(addressFrom);
              InternetAddress[] addressTo = new InternetAddress[recipients.length];
         for (int i = 0; i < recipients.length; i++)
         addressTo[i] = new InternetAddress(recipients);
         msg.setRecipients(Message.RecipientType.TO, addressTo);
         msg.setSubject(subject);
         msg.setContent(message, "text/plain");
         Transport tr = session.getTransport("smtp");
         tr.connect(SMTP_HOST_NAME, SMTP_AUTH_USER, SMTP_AUTH_PWD);
         msg.saveChanges(); // don't forget this
         //tr.sendMessage(msg, msg.getAllRecipients());
         tr.close();
         tr.send(msg);
         public class SMTPAuthenticator extends Authenticator
         public PasswordAuthentication getPasswordAuthentication()
         String username = SMTP_AUTH_USER;
         String password = SMTP_AUTH_PWD;
         return new PasswordAuthentication(username, password);
    the error i am receiving is:
    java.lang.NoClassDefFoundError: javax/mail/Authenticator
         java.lang.Class.getDeclaredConstructors0(Native Method)
         java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         java.lang.Class.getConstructor0(Unknown Source)
         java.lang.Class.newInstance0(Unknown Source)
         java.lang.Class.newInstance(Unknown Source)
         org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
         org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:292)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:230)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    If anyone has any ideas it will be much appreciated
    Thanks in Advance
    Andy

  • Assistance needed with simple java vocabulary program

    I need to construct a java program that can read in text documents. The program must then display an image and prompt the user to input the word that best-describes the image. If the user is incorrect, however, the program must tell the user how many letters the word has and what the first letter is.

    * @(#)words.java
    * @author
    * @version 1.00 2010/6/8
    import javax.swing.*; //class necessary for GUI
    import java.awt.*; //class necessary for GUI
    import java.awt.event.*; //class necessary for GUI
    import java.util.ArrayList; //import ArrayList class
    public class Words implements ActionListener { //ActionListener is required for the button to function
    //initialize values that will be used in other methods
    int noLetters = 0; //number of letters
    String[] words; //words
    JTextField textNL; //inputs number of letters
    ArrayList<JLabel> list;
    public static void main (String[] args) {
         Word s = new Word(); //this is so you are not referencing non-static methods from a static context (main must be static, but the constructor is not)
         s.go();} //runs following method as a method of the object Words s
    public void go() {
         //build GUI
              JFrame frame = new JFrame(); //intializes frame, this is essentially the GUI
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //sets program to stop when frame is exited
              JTabbedPane pane = new JTabbedPane(); //creates a new tabbed panel
              JPanel panel1 = new JPanel(); //creates input panel
              JPanel panel2 = new JPanel(); //creates output panel
              textNL = new JTextField("", 15); //initializes the text field of the same name from the beginning of the program
              JButton button = new JButton("Enter"); //This button will input the data you have entered into the text fields
              button.addActionListener(this); //tells the button to do stuff when it is clicked (see actionPerformed())
              panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); //Sets frame to display labels and text fields arranged vertically
              panel1.add(new JLabel("Number of Letters")); //this label tells you what the text field is prompting for
              panel1.add(textND); //adds text field to input panel
              panel1.add(BorderLayout.SOUTH, button); //adds button to input panel
              pane.add("Enter Data", panel1); //adds input panel to tabbed panel
              pane.add("Words", panel2); //adds output panel to tabbed panel
              frame.getContentPane().add(pane); //adds tabbed panel to frame
              frame.setSize(400, 400); //sets GUI intial dimensions
              frame.setVisible(true); //displays GUI
              //end of GUI build
    }

  • Simple Java probablitity program?

    Could anyone type up a simple probability program?
    For example...
    a has a chance of being picked .44
    b has .22
    c has .30
    d has .04
    All added equals 1.00
    So, how would I print a string of 50 chars, a through d, with those probabilities/chances?

    javalavalamp wrote:
    Hell, the last time I ever posted was Sept...
    Profile: http://forums.sun.com/profile.jspa?userID=1052864
    I'm not talking about here, I'm talking about posting the same question in multiple forums. Again, this will frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread.
    So again, what other fora did you post this in?

  • Simple Java Network Programming Question

    import java.io.*;
    import java.net.*;
    public class ConsumerClient
         private static InetAddress host;
         private static final int PORT = 1234;
         private static Socket link;
         private static Resource item;
         private static BufferedReader in;
         private static PrintWriter out;
         private static BufferedReader keyboard;
         public static void main(String[] args)     throws IOException
              try
                   host = InetAddress.getLocalHost();
                   link = new Socket(host, PORT);
                   in = new BufferedReader(new InputStreamReader(link.getInputStream()));
                   out = new PrintWriter(link.getOutputStream(),true);
                   keyboard = new BufferedReader(new InputStreamReader(System.in));
                   String message, response;
                   do
                        System.out.print("Enter 1 for resource or 0 to quit: ");
                        message = keyboard.readLine();
         if(message.equals("1")**
                             item.takeOne();**
                        //Send message to server on
                        //the socket's output stream...
                        out.println(message);
                        //Accept response from server on
                        //the socket's input stream...
                        response = in.readLine();
                        //Display server's response to user...
                        System.out.println(response);
                   }while (!message.equals("0"));
              catch(UnknownHostException uhEx)
                   System.out.println("\nHost ID not found!\n");
              catch(IOException ioEx)
                   ioEx.printStackTrace();
              finally
                   try
                        if (link!=null)
                             System.out.println("Closing down connection...");
                             link.close();
                   catch(IOException ioEx)
                        ioEx.printStackTrace();
    }

    georgemc wrote:
    BlueNo yel-- Auuuuuuuugh!
    But the real question is: What is the air-speed velocity of an unladen swallow?

  • Problem while executing simple java program

    Hi
    while trying to execute a simple java program,i am getting the following exception...
    please help me in this
    java program :import java.util.*;
    import java.util.logging.*;
    public class Jump implements Runnable{
        Hashtable activeQueues = new Hashtable();
        String dbURL, dbuser, dbpasswd, loggerDir;   
        int idleSleep;
        static Logger logger = Logger.getAnonymousLogger();      
        Thread myThread = null;
        JumpQueueManager manager = null;
        private final static String VERSION = "2.92";
          public Jump(String jdbcURL, String user, String pwd, int idleSleep, String logDir) {
            dbURL = jdbcURL;
            dbuser = user;
            dbpasswd = pwd;
            this.idleSleep = idleSleep;
            manager = new JumpQueueManager(dbURL, dbuser, dbpasswd);
            loggerDir = logDir;
            //preparing logger
            prepareLogger();
          private void prepareLogger(){      
            Handler hndl = new pl.com.sony.utils.SimpleLoggerHandler();
            try{
                String logFilePattern = loggerDir + java.io.File.separator + "jumplog%g.log";
                Handler filehndl = new java.util.logging.FileHandler(logFilePattern, JumpConstants.MAX_LOG_SIZE, JumpConstants.MAX_LOG_FILE_NUM);
                filehndl.setEncoding("UTF-8");
                filehndl.setLevel(Level.INFO);
                logger.addHandler(filehndl);
            catch(Exception e){
            logger.setLevel(Level.ALL);
            logger.setUseParentHandlers(false);
            logger.addHandler(hndl);
            logger.setLevel(Level.FINE);
            logger.info("LOGGING FACILITY IS READY !");
          private void processTask(QueueTask task){
            JumpProcessor proc = JumpProcessorGenerator.getProcessor(task);       
            if(proc==null){
                logger.severe("Unknown task type: " + task.getType());           
                return;
            proc.setJumpThread(myThread);
            proc.setLogger(logger);       
            proc.setJumpRef(this);
            task.setProcStart(new java.util.Date());
            setExecution(task, true);       
            new Thread(proc).start();       
         private void processQueue(){       
            //Endles loop for processing tasks from queue       
            QueueTask task = null;
            while(true){
                    try{
                        //null argument means: take first free, no matters which queue
                        do{
                            task = manager.getTask(activeQueues);
                            if(task!=null)
                                processTask(task);               
                        while(task!=null);
                    catch(Exception e){
                        logger.severe(e.getMessage());
                logger.fine("-------->Sleeping for " + idleSleep + " minutes...hzzzzzz (Active queues:"+ activeQueues.size()+")");
                try{
                    if(!myThread.interrupted())
                        myThread.sleep(60*1000*idleSleep);
                catch(InterruptedException e){
                    logger.fine("-------->Wakeing up !!!");
            }//while       
        public void setMyThread(Thread t){
            myThread = t;
        /** This method is only used to start Jump as a separate thread this is
         *usefull to allow jump to access its own thread to sleep wait and synchronize
         *If you just start ProcessQueue from main method it is not possible to
         *use methods like Thread.sleep becouse object is not owner of current thread.
        public void run() {
            processQueue();
        /** This is just another facade to hide database access from another classes*/
        public void updateOraTaskStatus(QueueTask task, boolean success){
            try{         
                manager.updateOraTaskStatus(task, success);
            catch(Exception e){
                logger.severe("Cannot update status of task table for task:" + task.getID() +  "\nReason: " + e.getMessage());       
        /** This is facade to JumpQueueManager method with same name to hide
         *existance of database and SQLExceptions from processor classes
         *Processor class calls this method to execute stored proc and it doesn't
         *take care about any SQL related issues including exceptions
        public void executeStoredProc(String proc) throws Exception{
            try{
                manager.executeStoredProc(proc);
            catch(Exception e){
                //logger.severe("Cannot execute stored procedure:"+ proc + "\nReason: " + e.getMessage());       
                throw e;
         *This method is only to hide QueueManager object from access from JumpProcessors
         *It handles exceptions and datbase connecting/disconnecting and is called from
         *JumpProceesor thread.
        public  void updateTaskStatus(int taskID, int status){       
            try{
                manager.updateTaskStatus(taskID, status);
            catch(Exception e){
                logger.severe("Cannot update status of task: " + taskID + " to " + status + "\nReason: " + e.getMessage());
        public java.sql.Connection getDBConnection(){
            try{
                return manager.getNewConnection();
            catch(Exception e){
                logger.severe("Cannot acquire new database connection: " + e.getMessage());
                return null;
        protected synchronized void setExecution(QueueTask task, boolean active){
            if(active){
                activeQueues.put(new Integer(task.getQueueNum()), JumpConstants.TH_STAT_BUSY);
            else{
                activeQueues.remove(new Integer(task.getQueueNum()));
        public static void main(String[] args){
                 try{
             System.out.println("The length-->"+args.length);
            System.out.println("It's " + new java.util.Date() + " now, have a good time.");
            if(args.length<5){
                System.out.println("More parameters needed:");
                System.out.println("1 - JDBC strign, 2 - DB User, 3 - DB Password, 4 - sleeping time (minutes), 5 - log file dir");
                return;
            Jump jump = new Jump(args[0], args[1], args[2], Integer.parseInt(args[3]), args[4]);
            Thread t1= new Thread(jump);
            jump.setMyThread(t1);      
            t1.start();}
                 catch(Exception e){
                      e.printStackTrace();
    } The exception i am getting is
    java.lang.NoClassDefFoundError: jdbc:oracle:thin:@localhost:1521:xe
    Exception in thread "main" ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
    JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [../../../src/share/back/util.c:820] Please help me.....
    Thanks in advance.....sathya

    I am not willing to wade through the code, but this portion makes me conjecture your using an Oracle connect string instead of a class name.
    java.lang.NoClassDefFoundError: jdbc:oracle:thin:@localhost:1521:xe

  • How to compile a simple "Hello World" program in Java by using Netbeans

    Hi all, I am very new to java programming arena. i am trying to learn the most demanding language for the time being. To program, i always use IDE's as it makes programming experience much easier by underline the syntax errors or sometimes showing codehint. However, I am facing some problem when i use Netbeabs to compile a simple "Hello world" program. my problem is whenever i write the code and press compile button, netbeans says "main class not found". Consequently,i am becoming frustated. So, i am here in this forum to get some kind help on How i can compile java programs in Netbeans. Please help me out, otherwise i may lose my enthusiasm in Java. please help me, i m stuck

    Go to http://www.netbeans.org/
    You should find tutorials there.

  • A simple Java program to be compiled with ojc and executed with java.exe

    Hi ,
    This thread is relevant to Oracle Java Compiler (file ojc) and jave.exe file.
    I have written a simple java program which consists of two simple simple classes and using the JDev's 10.1.3.2 ojc and java files , i'm trying to execute it after the successful compilation....
    The problem is that trying to run it... the error :
    Exception in thread "main" java.lang.NoClassDefFoundError: EmployeeTest
    appears.
    How can i solve this problem...????
    The program is as follows:
    import java.util.*;
    import corejava.*;
    public class EmployeeTest
    {  public static void main(String[] args)
       {  Employee[] staff = new Employee[3];
          staff[0] = new Employee("Harry Hacker", 35000,
             new Day(1989,10,1));
          staff[1] = new Employee("Carl Cracker", 75000,
             new Day(1987,12,15));
          staff[2] = new Employee("Tony Tester", 38000,
             new Day(1990,3,15));
          int i;
          for (i = 0; i < 3; i++) staff.raiseSalary(5);
    for (i = 0; i < 3; i++) staff[i].print();
    class Employee
    {  public Employee(String n, double s, Day d)
    {  name = n;
    salary = s;
    hireDay = d;
    public void print()
    {  System.out.println(name + "...." + salary + "...."
    + hireYear());
    public void raiseSalary(double byPercent)
    {  salary *= 1 + byPercent / 100;
    public int hireYear()
    {  return hireDay.getYear();
    private String name;
    private double salary;
    private Day hireDay;
    For compilation... i use :
    D:\ORACLE_UNZIPPED\JDeveloper_10.1.3.2\jdev\bin\ojc -classpath D:\E-Book\Java\Sun_Java_Book_I\Corejava EmployeeTest.java
    For execution , i issue the command:
    D:\ORACLE_UNZIPPED\JDeveloper_10.1.3.2\jdk\bin\java EmployeeTest
    NOTE:I tried to use the jdk of Oracle database v.2 but the error :
    Unable to initialize JVM appeared....
    Thanks , a lot
    Simon

    Hi,
    Thanks god....
    I found a solution without using Jdev.....
    C:\oracle_files\Java\Examples>SET CLASSPATH=.;D:\E-Book\Java\Sun_Java_Book_I\Corejava
    C:\oracle_files\Java\Examples>D:\ORACLE_UNZIPPED\JDeveloper_10.1.3.2\jdk\bin\javac EmployeeTest.java
    C:\oracle_files\Java\Examples>D:\ORACLE_UNZIPPED\JDeveloper_10.1.3.2\jdk\bin\java EmployeeTest
    What does Ant has to do with this?Sorry, under the Ant tree a classpath label is found....I'm very new to Java and JDev...
    You need to include the jar file that has the Day method in it inside project properties->libraries.I have not .jar file.. just some .java files under the corejava directory.... By the way , I have inserted the corejava directory to the project pressing the button Add Jar/Directory.... , but the problem insists..
    Thanks , a lot
    Simon

  • Running a Simple Java Program in Windows 7

    Hello:
    Learning Java.
    I have Windows 7 64 bit. I have following Java installed:
    C:\Program Files\Java\jdk1.6.0_21\demo>java -version
    java version "1.6.0_21"
    Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
    Java HotSpot(TM) 64-Bit Server VM (build 17.0-b17, mixed mode)
    My path is as follows:
    C:\Program Files\Java\jdk1.6.0_21\demo>path
    PATH= C:\Program Files\Java\jdk1.6.0_21\bin;C:\Windows\system32;C:\Windows;C:\Wi
    ndows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files
    (x86)\QuickTime\QTSystem\
    When I try to run a program called Exampleprogram.java as follows, I see below error:
    C:\Program Files\Java\jdk1.6.0_21\demo>java exampleprogram.java
    Exception in thread "main" java.lang.NoClassDefFoundError: exampleprogram/java
    Caused by: java.lang.ClassNotFoundException: exampleprogram.java
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Could not find the main class: exampleprogram.java. Program will exit.
    C:\Program Files\Java\jdk1.6.0_21\demo>
    Will appreciate your early help. Thanks.
    Victor

    Recomplied and still no luck. I gave a different name to the program and still getting the same error as follows:
    C:\Program Files\Java\jdk1.6.0_21\bin>dir hel*
    Volume in drive C is WINDOWS7PRO
    Volume Serial Number is EB0E-8900
    Directory of C:\Program Files\Java\jdk1.6.0_21\bin
    10/03/2010 11:29 AM 269 helloworld.java
    10/03/2010 11:33 AM 429 HelloWorldApp.class
    2 File(s) 698 bytes
    0 Dir(s) 123,998,978,048 bytes free
    C:\Program Files\Java\jdk1.6.0_21\bin>java helloworld.java
    Exception in thread "main" java.lang.NoClassDefFoundError: helloworld/java
    Caused by: java.lang.ClassNotFoundException: helloworld.java
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: helloworld.java. Program will exit.
    C:\Program Files\Java\jdk1.6.0_21\bin>
    Thoughts please.

  • Problems with a simple stop watch program

    I would appreciate help sorting out a problem with a simple stop watch program. The problem is that it throws up inappropriate values. For example, the first time I ran it today it showed the best time at 19 seconds before the actual time had reached 2 seconds. I restarted the program and it ran correctly until about the thirtieth time I started it again when it was going okay until the display suddenly changed to something like '-50:31:30:50-'. I don't have screenshot because I had twenty thirteen year olds suddenly yelling at me that it was wrong. I clicked 'Stop' and then 'Start' again and it ran correctly.
    I have posted the whole code (minus the GUI section) because I want you to see that the program is very, very simple. I can't see where it could go wrong. I would appreciate any hints.
    public class StopWatch extends javax.swing.JFrame implements Runnable {
        int startTime, stopTime, totalTime, bestTime;
        private volatile Thread myThread = null;
        /** Creates new form StopWatch */
        public StopWatch() {
         startTime = 0;
         stopTime = 0;
         totalTime = 0;
         bestTime = 0;
         initComponents();
        public void run() {
         Thread thisThread = Thread.currentThread();
         while(myThread == thisThread) {
             try {
              Thread.sleep(100);
              getEnd();
             } catch (InterruptedException e) {}
        public void start() {
         if(myThread == null) {
             myThread = new Thread(this);
             myThread.start();
        public void getStart() {
         Calendar now = Calendar.getInstance();
         startTime = (now.get(Calendar.MINUTE) * 60) + now.get(Calendar.SECOND);
        public void getEnd() {
         Calendar now1 = Calendar.getInstance();
         stopTime = (now1.get(Calendar.MINUTE) * 60) + now1.get(Calendar.SECOND);
         totalTime = stopTime - startTime;
         setLabel();
         if(bestTime < totalTime) bestTime = totalTime;
        public void setLabel() {
         if((totalTime % 60) < 10) {
             jLabel1.setText(""+totalTime/60+ ":0"+(totalTime % 60));
         } else {
             jLabel1.setText(""+totalTime/60 + ":"+(totalTime % 60));
         if((bestTime % 60) < 10) {
             jLabel3.setText(""+bestTime/60+ ":0"+(bestTime % 60));
         } else {
             jLabel3.setText(""+bestTime/60 + ":"+(bestTime % 60));
        private void ButtonClicked(java.awt.event.ActionEvent evt) {                              
         JButton temp = (JButton) evt.getSource();
         if(temp.equals(jButton1)) {
             start();
             getStart();
         if(temp.equals(jButton2)) {
             getEnd();
             myThread = null;
         * @param args the command line arguments
        public static void main(String args[]) {
         java.awt.EventQueue.invokeLater(new Runnable() {
             public void run() {
              new StopWatch().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JPanel jPanel1;
        // End of variables declaration                  
    }

    Although I appreciate this information, it still doesn't actually solve the problem. I can't see an error in the logic (or the code). The fact that the formatting works most of the time suggests that the problem does not lie there. As well, I use the same basic code for other time related displays e.g. countdown timers where the user sets a maximum time and the computer stops when zero is reached. I haven't had an error is these programs.
    For me, it is such a simple program and the room for errors seem small. I am guessing that I have misunderstood something about dates, but I obviously don't know.
    Again, thank you for taking the time to look at the problem and post a reply.

  • Error finding/creating AM from Java Concurrent Program

    Hi All,
    Here is what I am attempting to do in a Java concurrent program
    --------------- Code Start - Error description in the code snippet comments ---------------
    public void runProgram(CpContext pCpContext)
    DBTransactionImpl mDBTransactionImpl
    = new DBTransactionImpl(pCpContext.getJDBCConnection());
    OAApplicationModule am = null;
    // At this point I tried to call various methods on DBTransactionImpl
    // And each method call, causes the CP to error with a different exception
    // Calling findApplicationModule() causes the following exception
    // java.lang.NullPointerException
    // at oracle.jbo.server.DBTransactionImpl.findApplicationModule(DBTransactionImpl.java:4840)
    // at xxicon.oracle.apps.xbol.pa.cp.XXIconImportUnitsFrmXls.runProgram(XXIconImportUnitsFrmXls.java:101)
    // at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    am = mDBTransactionImpl.findApplicationModule(IMPORT_UNITS_AM_INS);
    // Calling createApplicationModule() causes the following exception
    // java.lang.NullPointerException
    // at oracle.jbo.server.DBTransactionImpl.createApplicationModule(DBTransactionImpl.java:4954)
    // at xxicon.oracle.apps.xbol.pa.cp.XXIconImportUnitsFrmXls.runProgram(XXIconImportUnitsFrmXls.java:109)
    // at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    am = mDBTrx.createApplicationModule( IMPORT_UNITS_AM_INS
         ,IMPORT_UNITS_AM_DEF);
    // Calling isConnected() causes the following exception
    // java.lang.NullPointerException
    // at oracle.jbo.server.DBTransactionImpl.isConnected(DBTransactionImpl.java:4335)
    // at xxicon.oracle.apps.xbol.pa.cp.XXIconImportUnitsFrmXls.runProgram(XXIconImportUnitsFrmXls.java:65)
    // at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    if (mDBTransactionImpl.isConnected())
    // Log the fact that DBTrx is connected
    --------------- Code End - Error description in the code snippet comments ---------------
    Would someone be kind enough to tell me what is it that I am doing wrong here?
    Thanks a ton!
    KH
    Message was edited by: Kiran
    kiran.k.hegde

    Kiran,
    How did you convert/cast the CpContext into an AppsContext to supply to createRootAM?
    Would you maybe share some more code?
    Update
    No need for that, a simple
    public void runProgram( CpContext ctx )
    String amName;
    String methodName;
    OAApplicationModuleFactory amF = new OAApplicationModuleFactory();
    OAApplicationModule am = amF.createRootOAApplicationModule( ctx, amName );
    am.invokeMethod( methodName );
    will do...
    Message was edited by:
    TyskJohan

  • Java Concurrent Program issue

    Hello,
    I am fairly new the Java Concurrent Programs concept. I was just trying a simple Hello World example but I cannot seem to run it from the operating system. Here is my Hello World java program I created using Jdeveloper:
    package oracle.apps.fnd.cp.request;
    public class Hello implements JavaConcurrentProgram {
    public static final String RCS_ID = "$Header$";
    public void runProgram(CpContext ctx) {
    ctx.getLogFile().writeln("-- Hello World! --", 0);
    ctx.getOutFile().writeln("-- Hello World! --");
    ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "");
    It compiles fine in Jdev generating the class file. Here is what I did :
    1) Created directory under $JAVA_TOP as follows :
    mkdir $JAVA_TOP/oracle/apps/fnd/cp/sample
    2) moved the Hello.java file there under sample directory
    3) compiled java file using avac $JAVA_TOP/oracle/apps/fnd/cp/sample/Hello.java ( It compiles fine generating the class file )
    4) Now I wanted to test running it : I tried using jre command first as I saw in other posts but this is not working :
    jre -Ddbcfile=$FND_TOP/secure/k021kp-6180_r115dev1.dbc -Drequest.outfile=/export/home/sqadri/outfile oracle.apps.fnd.cp.request.Run oracle.apps.fnd.cp.sample.Hello
    Error :
    ksh: jre: not found
    Then I tried using the other way I saw on posts which is using the java command :
    java -cp $AF_CLASSPATH -Ddbcfile=$FND_TOP/secure/k021kp-6180_r115dev1.dbc -Drequest.outfile=/export/home/sqadri/outfile oracle.apps.fnd.cp.request.Run oracle.apps.fnd.cp.sample.Hello
    This gives me the following error :
    java.lang.NoClassDefFoundError: oracle/apps/fnd/cp/sample/Hello (wrong name: oracle/apps/fnd/cp/request/Hello)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
    Can anyone tell me what I am doing wrong ? I have tried everything even tried ftp the class file from my local but I get the same error. Any help would be appreciated.
    Thanks

    Ajay,
    Yes you are right. I did not register my java program yet in the concurrent programs.
    I thought I could test it out from the operating system command line before registering it. But looking at your document you sent me it seems I have to do all the steps i.e. define concurrent program etc before I can test it from the operating system. If that's the case then what's the use of trying to test it via operating system using
    java -cp $AF_CLASSPATH -Ddbcfile=$FND_TOP/secure/k021kp-6180_r115dev1.dbc -Drequest.outfile=/export/home/sqadri/outfile oracle.apps.fnd.cp.request.Run oracle.apps.fnd.cp.sample.Hello
    Thanks
    Syed

  • Possible to extend java Concurrent Program and replace standard??

    Hi All!
    i have following developing need. There is a java concurrent program POXPOPDF (PO Output for Communication). The customer needs this program to do actually something complete different than printing the PO in PDF. The executable for this CP is java class PoGenerateDocumentCP in oracle.apps.po.communicate package.
    We thought that we may be able to extend that class and then in some way made OA to use the extended java class instead of the standard. This is possbile and simple for OA Framework pages unsing classes as controllers, but I don't know how it could be done for CP (if there's a way to do it without violent intervention in standard system).. Is it possbile, can anyone help me with this.
    The thing is that instead of reformatting the XML returned from PO_COMMUNICATION_PVT.POXMLGEN (function POXMLGEN in database package PO_COMMUNICATION_PVT) into PDF we want to reformat into another XML and then send it in other way to a webservice. Once I have the XML from POXMLGEN I have no problem to reformat it into another XML (I think, I have done it iwith other issues/processes). The webservice and the call to it is no problem and is already use with other purposes in other processes, but here (replaceing this stadard java class for an extension/new one) I am a little lost.
    Appreciate very much your help.
    Regards,
    Patricia

    Never mind, I see now that FND_REQUEST.SUBMIT_REQUEST() really does work, I tried with a different standard java concurrent program and it worked fine, and then I figured out that my parameters into fnd_request.submit_request for concurrent program APXVVCF4 were not correct (application short name was invalid for concurrent program).
    Thanks for the Info!

Maybe you are looking for