Pascal to Java Please help me!

I am truobled in creating a validation method for the user loging in....
As I am perfect at Pascal can anyone translate the following pascla code to Java Please help me with this.
PROGRAM USERLOGIN;
TYPE
  USER_TYPE = RECORD
    USERNAME : STRING[15];
    PASSWORD : STRING[15];
END;
    USFILE = FILE OF USER_TYPE;
VAR
   USER: USER_TYPE;
   CKUSER: USER_TYPE;
   RECFILE : USFILE;
   I,J     : INTEGER;
BEGIN
WRITE('ENTER USERNAME:');READLN(CKUSER.USERNAME);
WRITE('ENTER PASSWORD:');READLN(CKUSER.PASSWORD);
FILESPEC :='USERFILE.USR';
ASSIGN(RECFILE, FILESPEC);
RESET(RECFILE);
  WHILE NOT EOF(RECFILE) DO
   BEGIN
     READ(RECFILE, USER);
     IF CKUSER.USERNAME = USER.USERNAME AND CKUSER.PASSWORD = USER.PASSWORD THEN
          LOGIN
    ELSE
          WRITE('USER NOT FOUND');
   END;
END.Thank you

Don't bother:
http://forum.java.sun.com/thread.jsp?forum=54&thread=539277

Similar Messages

  • Why the same name of process comes out in AIX , in java. please help me.

    Hello.
    I have two questions related to Jvm.
    I've developed Job scheduler program which is doing somthing as the DB schedule is set in the way of Multi
    thread. Currently , I'm in the process of testing this one. It is good , if in the normal case. However, When
    doing Shell, if the application have so a lot to do the Shell, it has a little problem.
    My developing environment is
    OS : AIX 5.3
    JRE : IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr7-20091214_49398
    (JIT enabled, AOT enabled)
    nofiles(descriptors) 2000
    maxuproc 4096 Maximum number of PROCESSES allowed
    per user True
    In order to execute Shell in My Scheduler program , I tested Runtimeexec() or ProcessBuilder.
    The result of mine in the test , when the executed Shell got over 300 is
         1. The jvm processes that I execute at the first time are shown up , after Shell go to the finish, the
    processes are all in the disappearance again , and at last The processes that I executed at the first time are
    remaining. It's like the process is duplicated process in the maximum of 70.
    When I do shell about 200 to be executed simultaneously, Duplicated jvm about 3 appeared momentarily, then
    disappeared, and also under 120, No duplicated case is found when under 120.
    ps -ef result is below , when shell is excuted
    UID PID PPID C STIME TTY TIME CMD
    jslee 626906 1 0 11, May - 2:20 java -
    DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
    jslee 1421522 626906 0
    19:36:16 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
    ....Skip.....
    jslee 4374620 626906 0 19:34:06 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -
    Dfile.encoding=euc-kr jobserver.JobServerMain
    (the process list about 60)
    *the first question : Why a lot of duplicated jvm are shown up when in alot of shell to be executed ?
    *the second question : As you can see above , How can I solve out the problem.
    *Is there some option that I can set up when starting Jvm?
    ---Next question---
    My developing environment is
    OS : SunOS 5.8
    JRE : Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
    Java HotSpot(TM) Server
    VM (build 16.0-b13, mixed mode)
    nofiles(descriptors) 256
    As shown obove , the value of descriptors is 256 .
         My scheduler program executed 300 shell at the same time, in result my program was abnormalily
    terminated after doing shell about 180.
    the Exception info is
    java.io.IOException: Cannot run program "sh": error=24, exceeding the number of opened files
         at
    java.lang.ProcessBuilder.start(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at
    java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
    or
    java.net.SocketException: exceeding the number of opened files     at java.net.PlainSocketImpl.socketAccept
    (Native Method)
    또는
    java.io.IOException: exceeding the number of opened files     at
    java.io.UnixFileSystem.createFileExclusively(Native Method)
         at java.io.File.checkAndCreate(Unknown
    Source)
         at java.io.File.createTempFile(Unknown Source)
    *question : If I continuously request to open a file that go over system limit, is it possible for JVM to be
    terminated?
    *question : Is there a method that obtains state of System limit in the java library.
    *question : what is the best solution to cope with ?
    Please help me
    =

    struts-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
      <form-beans>
           <form-bean name="registrationForm" type="ndlinh.struts.lab.RegistrationForm" />
      </form-beans>
      <action-mappings>
           <action path="/register"
                   type="ndlinh.struts.lab.RegistrationAction" // action class
                   name="registrationForm" // form bean name
                   validate="false"
                   scope="request"
                   input="registration.jsp" >
                <forward name="success" path="/jsp/success.jsp"  />
                <forward name="failure" path="/jsp/failure.jsp"  />
           </action>
      </action-mappings>
    </struts-config>HTH

  • Very new to java please help

    i'm very new to java and i'm getting an error in my application. i took 4 applications that compiled and worked separatly and i tried to combine them into one application. i'm getting the error: unreported exception java.io.IOException; must be caught or declared to be thrown, in lines 73,78,83,88,120,146,149,152,155 in the and it points at the keyboard.readLine() but everything i've tried just gives me more errors. please help anything and everything will be greatly appreciated. here it is, sorry about format i dunno how to straighten it in here:
    // ^ ^
    //               (0)(0) A Happy Piggy Application
    // Problems: 2.6,2.8,2.9,2.12 (oo)
    // An application finds the total number of hours, minutes, & seconds, finds the distance
    // between two points, finds the volume and surface area of a sphere, and adds up the change
    // in a jar. First, the total hours, minutes, and seconds problem.
    import java.io.*;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    public class twoptsix
         static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
         static PrintWriter screen = new PrintWriter(System.out, true);
         public static void main (String[] args) throws IOException
              double hoursa, minutesa, secondsa;
              String hours;
              System.out.print ("Please enter a number of hours: ");
    hours = keyboard.readLine();
    hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
    String minutes;
    System.out.print ("Please enter a number of minutes: ");
    minutes=keyboard.readLine();
    minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
    String seconds;
    System.out.print ("Pretty please enter a number of seconds: ");
    seconds = keyboard.readLine();
    secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
    double allseconds;
    allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
    System.out.println ("You have: " + hours + " hours..."); //displays hours
    System.out.println ("" + minutes + " minutes..."); //displays minutes
    System.out.println ("and " + seconds + " seconds..."); //displays seconds
              System.out.println ("to get whatever you need to done!"); //witty attempt at humor
    System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
    // An application that finds the distance between two points when the points
    // are given by the user.
              double x1, x2, y1, y2, total, distance;
              String xa;
              System.out.print ("Please enter the 'x' coordinate of first point: ");
              xa = keyboard.readLine();
              x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
              String ya;
              System.out.print ("...also need the 'y' coordinate of first point: ");
              ya = keyboard.readLine();
              y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
              String xb;
              System.out.print ("...and the 'x' coordinate of the second point: ");
              xb = keyboard.readLine();
              x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
              String yb;
              System.out.print ("...don't forget the 'y' coordinate of the second point: ");
              yb = keyboard.readLine();
              y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
              total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
              distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
              System.out.print ("E=mc^2...oh and,");
              System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
              xb + "," + yb + ") is : " + distance);
    // An application that takes the radius of a sphere and finds and prints
    // the spheres volume and surface area.
              double radius,volume,area;
              String rad;
              System.out.print("Please enter the radius of a sphere: ");
              rad = keyboard.readLine();
              radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
    DecimalFormat fmt = new DecimalFormat ("0.####");
              volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
              System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
              area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
              System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
    // An application that finds the total, in dollars and cents, of a number of quarters,
    // nickels, dimes, and pennies in your piggy bank.
              int pennies, nickels, dimes, quarters;
              double money1;
              screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
              int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
              screen.println("How many dimes?: ");
              int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
              screen.println("How many nickels?: ");
              int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
              screen.println("How many pennies?: ");
              int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
              NumberFormat money = NumberFormat.getCurrencyInstance();
              money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
              screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total money

    Ok here is the working code as one long function:
    // ^ ^
    // (0)(0) A Happy Piggy Application
    // Problems: 2.6,2.8,2.9,2.12 (oo)
    // An application finds the total number of hours, minutes, & seconds, finds the distance
    // between two points, finds the volume and surface area of a sphere, and adds up the change
    // in a jar. First, the total hours, minutes, and seconds problem.
    import java.io.*;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    public class twoptsix
        static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
        static PrintWriter screen = new PrintWriter(System.out, true);
        public static void main (String[] args) throws IOException
    double hoursa, minutesa, secondsa;
    String hours;
    System.out.print ("Please enter a number of hours: ");
    hours = keyboard.readLine();
    hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
    String minutes;
    System.out.print ("Please enter a number of minutes: ");
    minutes=keyboard.readLine();
    minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
    String seconds;
    System.out.print ("Pretty please enter a number of seconds: ");
    seconds = keyboard.readLine();
    secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
    double allseconds;
    allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
    System.out.println ("You have: " + hours + " hours..."); //displays hours
    System.out.println ("" + minutes + " minutes..."); //displays minutes
    System.out.println ("and " + seconds + " seconds..."); //displays seconds
    System.out.println ("to get whatever you need to done!"); //witty attempt at humor
    System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
    // }  <----- MAIN FUNCTION USED TO END HERE!!!
    //but we want to keep going so remove the bracket!
    // An application that finds the distance between two points when the points
    // are given by the user.
    // {  <-- other function used to start here, but now it continues
    double x1, x2, y1, y2, total, distance;
    String xa;
    System.out.print ("Please enter the 'x' coordinate of first point: ");
    xa = keyboard.readLine();
    x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
    String ya;
    System.out.print ("...also need the 'y' coordinate of first point: ");
    ya = keyboard.readLine();
    y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
    String xb;
    System.out.print ("...and the 'x' coordinate of the second point: ");
    xb = keyboard.readLine();
    x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
    String yb;
    System.out.print ("...don't forget the 'y' coordinate of the second point: ");
    yb = keyboard.readLine();
    y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
    total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
    distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
    System.out.print ("E=mc^2...oh and,");
    System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
         xb + "," + yb + ") is : " + distance);
    //second function used to end here...
    //} <--- COMMENT OUT BRACKET SO WE CONTINUE
    // An application that takes the radius of a sphere and finds and prints
    // the spheres volume and surface area.
    //{ <--- ANOTHER ONE TO COMMENT OUT
    double radius,volume,area;
    String rad;
    System.out.print("Please enter the radius of a sphere: ");
    rad = keyboard.readLine();
    radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
    DecimalFormat fmt = new DecimalFormat ("0.####");
    volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
    System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
    area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
    System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
    // } <----- COMMENTED OUT FOR THE SAME REASON
    // An application that finds the total, in dollars and cents, of a number of quarters,
    // nickels, dimes, and pennies in your piggy bank.
    //{ <----AND ANOTHER
    int pennies, nickels, dimes, quarters;
    double money1;
    screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
    int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
    screen.println("How many dimes?: ");
    int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
    screen.println("How many nickels?: ");
    int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
    screen.println("How many pennies?: ");
    int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
    NumberFormat money = NumberFormat.getCurrencyInstance();
    money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
    screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total money
    }P.S. To make the code formatted better put [ code ] before and [ /code ] after. It's not perfect, but a little better...

  • M new to this forum + new to java please help me with file handling program

    hi i want to make a file handling program where in i want to input a text file say f1 whose style is mentioned as below
    aaa...bcd
    aaabbc
    acdce
    a..dd
    abbcd
    now i want to write d out put of file f1 to file f2 but only those string entries widout any ... in them how to do that :-(( please help :((

    import java.io.*;
    import java.lang.*;
    class javcsse{
             void javsce (){
              BufferedReader in;
            PrintWriter out;
            String line;
            try
                in = new BufferedReader(new FileReader("e:\\cntcs\\n7.txt"));
                out = new PrintWriter("e:\\cntcs\\n8.txt");
               line = in.readLine();
               while(line != null)
                     if(line.contains("...") && line.contains("....")){
                         break ;                
                         else{
                               if(line.contains("cc"))
                              System.out.println(line+"\n");
                                      out.println(line);
                    line = in.readLine();
                in.close();
                out.close();
            } catch (Exception ex)
                System.err.println(ex.getMessage());
      public class javcse{
        public static void main(String[] args) {
            new javcsse();
    }hey i wrote this code yet could u tell y is it still not working :((

  • I am new to java please help!!

    please help ive got a method thta i wanto to use it in another class, but it does not work.
    //prueba.java
    import java.io.*;
    public class prueba
    public int numero3;
    public int suma(int numero1,int numero2)
    int numero3=numero1+numero2;
    return numero3;
    //prueba1.java
    import javax.servlet.*;
    import java.io.*;
    import javax.servlet.http.*;
    import prueba;
    public class prueba1 extends HttpServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    PrintWriter out = res.getWriter();
    int num1=1;
    int num2=1;
    prueba uno=new prueba();
    out.println(uno.suma(2,3));
    when i ty to complie this file it throws me thie errors:
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:4: cannot resolve symbol
    symbol: class prueba
    import prueba;
    ^
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
    prueba uno=new prueba();
    ^
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
    prueba uno=new prueba();
    ^
    3 errors
    Tool completed with exit code 1
    both , prueba1.java and prueba.java are in the same folder.

    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
         prueba uno=new prueba();
    ^
    C:\resin-2.0.b2\doc\content-manager\admin\web-inf\classes\prueba1.java:15: cannot resolve symbol
    symbol : class prueba
    location: class prueba1
         prueba uno=new prueba();
    ^
    2 errors

  • Recursion in java. please help

    I am writing a program for tree traversing as follows. The program is relatively long but please just focus on 2 lines with errors indicated.
    import java.io.*;
    import myBinaryTree;
    class myBinaryTreeTest{
         static int vertexArray[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 3, 3, 7, 9, 11, 5, 11};     
         static myBinaryTree treeArray[] = new myBinaryTree[10];
         static myBinaryTree tree;
         static pTwoChildNode nodeParent, nodeLeft, nodeRight;
         static treeNodeData dataParent, dataLeft, dataRight;
         public static void main(String[] args) {
         for (int j=0; j<10; j++) {
         treeArray[j]=new myBinaryTree();
    boolean treeArrayEmpty;
    int treeArrayEmptyIndex;
    int treeArrayChildIndex, treeArrayParentIndex;
              int vertexCollapseChild, vertexCollapseParent;
              for (int i=0; i<20; i=i+2) {
    vertexCollapseChild=vertexArray;
    vertexCollapseParent=vertexArray[i+1];
    treeArrayEmptyIndex=-1;
    treeArrayChildIndex=-1;
              treeArrayParentIndex=-1;          
              for (int j=0; j<10; j++) {
                   if (treeArray[j].isEmpty()) {
    if (treeArrayEmptyIndex == -1) {
    treeArrayEmptyIndex=j;
    else {
    dataParent = (treeNodeData)treeArray[j].getData();
                   if (vertexCollapseChild==dataParent.vertex)
    {treeArrayChildIndex=j;};
    if (vertexCollapseParent==dataParent.vertex)
    {treeArrayParentIndex=j;};
    if (treeArrayChildIndex != -1 && treeArrayParentIndex != -1)
                        {break;}
    updateTreeArray(treeArrayChildIndex, treeArrayParentIndex,
                        treeArrayEmptyIndex, vertexCollapseChild,
    vertexCollapseParent);
              for (int j=0; j<10; j++) {                                               
                   System.out.println("\nIn-order:");
                   preOTrav(treeArray[j].getRoot());
         static void updateTreeArray(int c, int p, int e, int cc, int cp) {
                                  // c=treeArrayChildIndex
                                  // p=treeArrayParentIndex
                                  // e=treeArrayEmptyIndex
                                  // cc=vertexCollapseChild
                                  // cp=vertexCollapseParent
    System.out.println(c+" "+p+" "+e+" "+cc+" "+cp);
         if (c != -1) {
    if (p != -1) {
         dataParent = new treeNodeData();
              dataRight = (treeNodeData)treeArray[p].getData();
    dataParent.vertex=dataRight.vertex;
              nodeParent=new pTwoChildNode(dataParent);
    nodeParent.setLeft(treeArray[c].getRoot());
    nodeParent.setRight(treeArray[p].getRoot());
    treeArray[Math.min(c, p)].setRoot(nodeParent);
    treeArray[Math.max(c, p)].setRoot(null);
         else
              dataParent = new treeNodeData();
    dataParent.vertex=cp;
              nodeParent=new pTwoChildNode(dataParent);
    nodeParent.setLeft(treeArray[c].getRoot());
              dataRight = new treeNodeData();
    dataRight.vertex=cp;
              nodeParent.setRight(new pTwoChildNode(dataRight));
    treeArray[Math.min(c, e)].setRoot(nodeParent);
              treeArray[Math.max(c, e)].setRoot(null);
    else
    if (p != -1) {
    dataParent = new treeNodeData();
    dataRight = (treeNodeData)treeArray[p].getData();
    dataParent.vertex=dataRight.vertex;
              nodeParent=new pTwoChildNode(dataParent);
    dataLeft = new treeNodeData();
    dataLeft.vertex=cc;
    nodeParent.setLeft(new pTwoChildNode(dataLeft));
    nodeParent.setRight(treeArray[p].getRoot());
    treeArray[Math.min(p, e)].setRoot(nodeParent);
              treeArray[Math.max(p, e)].setRoot(null);
              else {
    dataParent=new treeNodeData();
    dataParent.vertex=cp;
              nodeParent=new pTwoChildNode(dataParent);
    dataRight=new treeNodeData();
    dataRight.vertex=cp;
              nodeRight=new pTwoChildNode(dataRight);
    nodeParent.setRight(nodeRight);
    dataLeft=new treeNodeData();
    dataLeft.vertex=cc;
              nodeLeft=new pTwoChildNode(dataLeft);
    nodeParent.setLeft(nodeLeft);
    treeArray[e].setRoot(nodeParent);
         static void preOTrav(pTwoChildNode n) {
              if (n == null)
              return;
              dataParent=(treeNodeData)n.getData();
              System.out.print(dataParent.vertex+" ");
              preOtrav(n.getLeft());
              preOtrav(n.getRight());
    //problems are here!!!!!
    class treeNodeData {
         int vertex;
         // data element2 -> a set of vertex fan;
    It doesn't compile but with the message saying that can not resolve the symbol in preOTrav(n.getLeft()); and preOTrav(n.getRight());
    Please help!

              preOtrav(n.getLeft());
              preOtrav(n.getRight());Don't write preOtrav when you mean preOTrav. Java is case-sensitive.
    Jesper

  • New to Java, Please help

    Hi, I was trying to play a game and came up with this java error (below), I uninstalled and reinstalled still no fix. I think i need a new class?, If anyone can explain the potential problem to me and help me fix it, that would be much appreciated. I'm a complete NEWB when it comes to java, I'm not even sure how to edit that code. so please remember to explain in the newbiest of newby answers. I am proficient with features of a computer just not java.
    Java Plug-in 1.6.0_24
    Using JRE version 1.6.0_24-b07 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Ethan
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class loader.class not found.
    java.lang.ClassNotFoundException: loader.class
    at sun.plugin2.applet.Applet2ClassLoader.fi… Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.lo… Source)
    at sun.plugin2.applet.Plugin2Manager.create… Source)
    at sun.plugin2.applet.Plugin2Manager$Applet… Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.ClassNotFoundException: loader.class

    845681 wrote:
    Hi, I was trying to play a game and came up with this java error (below), I uninstalled and reinstalled still no fix. I think i need a new class?, If anyone can explain the potential problem to me and help me fix it, that would be much appreciated. I'm a complete NEWB when it comes to java, I'm not even sure how to edit that code. so please remember to explain in the newbiest of newby answers. I am proficient with features of a computer just not java.If you want to learn how to program java, which is not the same as playing that particular game then you can start with the following link.
    http://download.oracle.com/javase/tutorial/getStarted/index.html

  • Fundamental questions in Java, please help to answer.

    I am a beginner of a Java Programming. Although I had few programming experiences on Java. But there are few conceptal questions. Hope every experts can help to explain more to me.
    1. How <b>Encapsulation</b> works in Java? Why is it needed? What benefits can be given from encapsulation? Can give some examples for me to know more?
    2. How <b>Overloading</b> works in Java? Why is it needed? What benefits can be given from it in the extensibility of programs? Can give some examples for me to know more?
    3. How <b>inheritance</b> works in Java? What benefits can be given from inheritance? Can give further explanation, such as class hierarchy for me to know more?
    4. What is <i>object class</i> and <i>object distances</i> ? What is their differences?
    5. What is <b>Reusability</b>? What benefits can it gives? Why it is needed? Can give me further examples?
    Thanks for help very much

    Maybe I'm not getting this, but you want one of us to give you a nice short answer convenient enough for you to copy down, right? Well, there aren't many people here that are willing to do that. There are many people who won't even bother answering homework questions. I don't mind, but you need to show us some work you've done, like the previous poster said. The effort has to come from you, not us. If you are learning Java, you must put some effort into it.
    How can you get an answer out of us?
    Example: I understand that inheritance is ..............., but I'm not sure about this part.............. Can anyone provide some clarification please?
    Anyway, this question has been crossposted on at least 5 forums already, which I'm sure is one of the reasons people aren't bothering with this question. Please DO NOT CROSSPOST, it's considered poor forum etiquette.
    Please don't take anything that I said negatively, but you have to understand that we are taking our time to respond to your queries, and asking us to provide short answers without doing any work on your part, and crossposting is not going to get you answers out of us.
    Cheers

  • Totally New in Java - Please help!!

    Hi Dear all,
    l am totally new in Java, and l facing one problem,and really hope can get some help from yours,please!
    l need to write this program:
    The program should do the following:
    1. Input two fields: action (action: add / delete), and account number (any
    digit or character)
    2. if the action is "add" then the program adds one text line to a text
    file.
    "New account is <account number>"
    3. create the text file if it is not already exist (in c:\)
    4. When program runs again with new input values, a new line will be
    appended to the same file.
    5. if the action is "delete" then the program finds the record and removes
    the text line from the file.
    My problem is :
    l just know that l need to create the user interface first,but l don't know how to go on??
    Would you please show me some step how to solve these problem?
    Many many thanks!!
    BaoBao

    I don't know about Swing. I never use it.
    The stuff to create and manipulate files is in the java.io package.
    You'll probably want to use java.io.FileReader and java.io.FileWriter.
    Note that FileWriter has a constructor that lets you append and not overwrite.
    I'll start you off with a test.
    public class AccountListAddTest() {
      public static void main(String[] argv) {
        AccountList accts = new AccountList();
        accts.add("abcdefg12345"); // arg is a hypothetical account number
    }Write an AccountList class that'll work if you compile and run this test. After you run this test for the first time, the file should contain the string
    New account is abcdefg12345.
    This test assumes that the filename is hardcoded into the AccountList class. To keep it simple, make the add method create a new appending FileWriter each time, write, then close the writer.

  • Adding binary numbers in java please help!!

    Hello all, im a total newbie to java and i need your help urgently, i have two variables
    that are integers, that store binary numbers i.e.
    int tmpIntOne, tmpIntTwo;
    tmpIntOne = 1010;
    tmpIntTwo = 1110;
    i want to add these numbers together and return a binary result so far when you add them together you get:
    2120
    however i would like a binary result so that
    result = tmpIntOne + tmpIntTwo;
    = 11000
    Thank you.

    Hello all, im a total newbie to java and i need your
    help urgently, i have two variables
    that are integers, that store binary numbers i.e.
    int tmpIntOne, tmpIntTwo;
    tmpIntOne = 1010;
    tmpIntTwo = 1110;These are not binary numbers. These are decimal numbers whose digits consist of ones and zeros. If you want to interpret the characters "010" as a binary number, then do
    int tmp1 = Integer.parseInt("1010", 2);
    etc.
    i want to add these numbers together
    int result = tmp1 + tmp;
    and return a
    binary result Adding two ints will give an int. Int's are always binary. If you want to display it as a binary String, as opposed to the usual decimal String, then, as suggested, use toBinaryString.

  • Main method question in java, please help

    Guys I have looked all over the internet, and cannot understand any of these questions: I would really appreciate any help on them. The first, and most important thing I would like to know is, what is static: what is a static int, or a static main method? Why is this necessary, and what does it do? Could you please provide an example? Also, why is String[] args necessary within the parameters of the main method? Is this so that it can execute it? Last thing is: objects. Where can I learn about them? I know they are made with the new operator, but don't understand their use? Could you explain why they are useful? Can you give them values? and how do they relate to the dot operator? After these are answered, I will be so happy because I will feel like I actually know a little bit. Right now, I'm just confused... Thank you so, so much in advance!

    The first, and most important thing I would like to know is, what is static'static' means that the item concerned is associated with the class itself rather than an instance: so, it is accessible to all instances.
    Could you please provide an example?
    public static void main(String[] args)is an example, but you knew that. I don't really understand the question.
    Also, why is String[] args necessary within the parameters of the main method?'args' receives the arguments you type on the command line after the class name or jar name, depending on how you invoke the application.
    This is all covered in the documentation, which you should read before asking further questions.
    Last thing is: objects. Where can I learn about them?If you don't know about objects you're not going to learn about them by asking questions on a forum. It's far too large a topic. Get yourself a book.

  • Can u tell me how to check my computer ip address in java (please help me)

    hi to all, can u tell me how to check my computer ip adress in java, what is the command for that

    import java.net package in your code.
    Then where you need to find the IP, please insert the following code.
    InetAddress inAddr = InetAddress.getLocalHost();
    String ipAddr = inAddr.getHostAddress();
    That should do it.
    Best Wishes,
    Ramanujam

  • Developing a shopping cart in java please help

    Implement a shopping cart with following features.
    1. Create items with required attributes.
    2. Define shopping cart parameters
    3. define stock values
    4. Create an order
    5. add to cart
    6. Copy cart
    7. remove item from cart
    8. Check out
    9. Print history.

    dhaval_shah wrote:
    What do you need help with?he's ordering you to do it for him. Not even a "please" to make it sound like a request.
    Of course we're not anyone's homework service (though a lot of kids seem to be under the impression that we are) so the kid can expected to be flamed and made fun of (which will likely lead to him getting agressive and abusive, leading to even more fun for us regulars and his eventual bannishment).

  • New to java, please help me :(

    hi, i have to complete a BMI calculator with arrays and switch, i need it so that if input a / b is selected it will calculate metric / imperial (i know that both calcs are the same, its just a placeholder for the time being). once thats selected users are asked to input name, age, height and weight, then looped again for another user to input into the array.
    once completed the name and age along with the BMI calculation for all the users that have inputted are displayed
    the problem is, the calculations are wrong, where it should be outputting a BMI of between 20-23ish im getting 0.3
    i think i had this problem when i done the switch example previously, but to fix that i just lumped all the code (inputs and calcs) into each case. in this method im guessing that would be an incorrect approach ?
    btw, sorry for my layout, ive been debugging for ages now and havnt had time to clean it up :/
    thank you in advance and heres my code:-
    package bmicalculationex;
    import javax.swing.*;
    public class Main {
    public static void main(String[] args) {
    String output;
    double Hfeet=0, Wstone=0, Hinches=0, Wlbs=0;
    String Hfeetstr, Wstonestr, Hinchesstr, Wlbsstr, age;
    String name;
    double bmiweight=0, bmiheight=0, BMI=0;
    Item[] myItemArray = new Item[2];
    for(int i = 0;i<2;i++){
    myItemArray[i] = new Item();
    String input = JOptionPane.showInputDialog(
    "Welcome to Chunks BMI calculator\n"+
    "a) Metric.\n"+
    "b) Imperial\n"+
    "q) Quit\n"+
    "\nPlease enter letter code" );
    char code = input.charAt(0);
    switch(code){
    case 'a':
    output= "Imperial.";
    Wlbs = Wlbs * 0.45359237;
    Hinches = Hinches * 0.0254;
    Hfeet = Hfeet * 0.3048;
    Wstone = Wstone * 6.35029318;
    break;
    case 'b': output= "Metric.";
    Wlbs = Wlbs * 0.45359237;
    Hinches = Hinches * 0.0254;
    Hfeet = Hfeet * 0.3048;
    Wstone = Wstone * 6.35029318;
    break;
    default: output= "Error.";
    JOptionPane.showMessageDialog(null,"Invalid Selection.\n"+ "Please try again.");
    JOptionPane.showMessageDialog(null, "You have selected :- " + output + "\n\n" +" Thank you.");
    //User In-
    for(int c=0;c<2;c++){
    name = JOptionPane.showInputDialog("enter your name");
    age = JOptionPane.showInputDialog("enter your age");
    Hfeetstr = JOptionPane.showInputDialog("enter your Height");
    Hinchesstr = JOptionPane.showInputDialog("enter the remainder");
    Wstonestr = JOptionPane.showInputDialog("enter your weight");
    Wlbsstr = JOptionPane.showInputDialog("enter the remainder");
    Hfeet = Float.parseFloat(Hfeetstr);
    Wstone = Float.parseFloat(Wstonestr);
    Hinches = Float.parseFloat(Hinchesstr);
    Wlbs = Float.parseFloat(Wlbsstr);
    bmiweight = Wstone + Wlbs;
    bmiheight = Hinches + Hfeet;
    BMI = bmiweight / (bmiheight*bmiheight);
    myItemArray[c].setname(name);
    myItemArray[c].setyear(age);
    myItemArray[c].setBMII(BMI);
    String message = "";
    for(int n=0;n<2;n++){
    message = message + "Name :- " + myItemArray[n].getname() + " " + "Age :- " + " " + myItemArray[n].getaged() + "BMI :- " + " " +myItemArray[n].getBMI() +"\n";
    JOptionPane.showMessageDialog(null, message);
    }//end of main method
    }//end of main class
    class Item{
    private String namea;
    private String agea;
    private double BMIa;
    public Item(){
    agea = "";
    BMIa = 0;
    namea = "";
    public Item(String nameb, String ageb, double BMIb){
    namea = nameb;
    agea = ageb;
    BMIa = BMIb;
    public String getname(){
    return namea;
    public String getaged(){
    return agea;
    public double getBMI(){
    return BMIa;
    public String setname (String nameb){
    namea = nameb;
    return nameb;
    public void setyear(String ageb){
    agea = ageb;
    public void setBMII(double BMIb){
    BMIa = BMIb;
    }

    yush !
    i done it :D
    i just ended up lumping all the code into each case like i did last time, as when i had the calculations outside of the cases it wasnt taking the values from inside the case. nevermind....
    another problem i do have though, i need a loop so that once the program finishes it repeats itself until an X is entered, im not very good with loops :S
    i tend to try it like this
    quit = 1;
    while (quit<2){
    then just have one of the cases as quit +1
    so in mine it looks liek this:
    int quit=1;
    while (quit<2){
    String input = JOptionPane.showInputDialog(
    "Welcome to Chunks BMI calculator\n"+
    "a) Metric.\n"+
    "b) Imperial\n"+
    "q) Quit\n"+
    "\nPlease enter letter code" );
    char code = input.charAt(0);
    switch(code){
    case 'a':
    JOptionPane.showMessageDialog(null, "You have selected imperial. "+"\n\n" +" Thank you.");
    for(int c=0;c<2;c++){
    name = JOptionPane.showInputDialog("enter your name");
    age = JOptionPane.showInputDialog("enter your age");
    Hfeetstr = JOptionPane.showInputDialog("enter your Height in feet");
    Hinchesstr = JOptionPane.showInputDialog("enter the remaining inches");
    Wstonestr = JOptionPane.showInputDialog("enter your weight in stone");
    Wlbsstr = JOptionPane.showInputDialog("enter the remaining lbs");
    Hfeet = Float.parseFloat(Hfeetstr);
    Wstone = Float.parseFloat(Wstonestr);
    Hinches = Float.parseFloat(Hinchesstr);
    Wlbs = Float.parseFloat(Wlbsstr);
    Wlbs = Wlbs * 0.45359237;
    Hinches = Hinches * 0.0254;
    Hfeet = Hfeet * 0.3048;
    Wstone = Wstone * 6.35029318;
    bmiweight = Wstone + Wlbs;
    bmiheight = Hinches + Hfeet;
    BMI = bmiweight / (bmiheight*bmiheight);
    String cat="";
    if (BMI <18.5) cat = ("Posh spice");
    else if (BMI >= 18.5 && BMI <=25) cat = ("Fit !");
    else if (BMI >25 && BMI <=30) cat = ("Fatty !");
    else if (BMI >30)cat = ("Super Fatty");
    myItemArray[c].setcat(cat);
    myItemArray[c].setname(name);
    myItemArray[c].setyear(age);
    myItemArray[c].setBMII(BMI);
    break;
    case 'b': output= "Metric.";
    etc.....
    this is causing me the problems:
    for(int i = 0;i<2;i++){
    myItemArray[i] = new Item();
    says a non static variable cannot be referenced from a static context, i know im being stupid with my implementation, but whats a better way ?
    thanks again :)
    Edited by: Clunk on Nov 17, 2008 4:05 PM

  • My first step in Java, please help me.

    I've just installed J2SDK1.4.0_03 and I'm reading the first pages of the Java tutorial.
    I've created a work folder : C:\Java
    I'm working with an msdos session of windows 2000
    I've created my first example class, prthello.java with NotePad :
    class prthello{
    public static void main(String args[]) {
    System.out.println("Hello World!");
    I've successful compilated it (javac prthello.java) and generated the prthello.class
    I've tried to execute it (java prthello) but it doesn't work and i receive the following message :
    Exception in thread "main" java.lang.NoClassDefFoundError: prthello
    The path should be correct (C:\Programmi\j2sdk1.4.0_03\bin) ,
    any suggestions would be appreciate.
    Thanking in Advance
    Andrea Giussani
    Milano, Italy

    Thank you for your suggestions, but i have already checked.
    The path is ok, i've installed jsdk under folder "programmi" and the path is :
    C:\>set path
    Path=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\PROGRA~1\IBM\CLIENT~1;
    C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~1\Emulator;C:\Programmi\F
    ile comuni\Autodesk Shared\;C:\Programmi\j2sdk1.4.0_03\bin
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    prthello.java and prthello.class are in the same folder (C:\java) where i executed javac with success and java with the error above mentioned.
    Any other suggestions ? Should I reinstall the JSDK ?
    Thanking in advance,
    Andrea Giussani

Maybe you are looking for

  • Mac mini Late 2014 screen flicking

    Just got  the Mac mini Late 2014 a week ago. It serves me well except the screen flicks randomly. I have connected Mac mini to two BenQ monitors, one via mini-display port HDMI adaptor (lets said this is port A), another one via mini-display port to

  • InDesign Crash / Spelling Panel

    Hi, i got a MacBookPro Corei5 with MacOs 10.6.8 full updated. I use CS6 Design Standard and especially InDesign. It'a updated. I often got theses 2 error messages above. I reinstall Adobe CS6 Design Standard after have removed it with the Adobe CS Cl

  • WRITE panel on Thunderbird v 31.3 flashes white to grey

    I have had all manner of password problems setting Thunderbird v 31.3 up with an FS.NET email account. Having finally achieved it so emails are received I have a problem now with email addresses turning RED when entered but more importantly the WRITE

  • When starting fire faox I get Unresponsive script Chrome:/tavgp/content/libs/include.js.595 this started after upgrade to v5

    Fire fox will not open, just get a warning unresponsive script. Script: chrome:/tavgp/content/libs/include.js:595 If I click stop script firefox will open, how do I resovle this issue I have tried reinstalling but still get the same problem.

  • User registration bp role

    Heloo all, When ever the user is registered in icss its getting created as consumer, internet user role in sap crm . How to create sold to party role as default. Please give me guidelines. Priya