Help on simple class definition

This is just the class definition (main() is in its own file, but I was wondering if someone could help me figure out what is wrong w/ the code. I am trying to make a simple program that asks, "what is your name?", than you enter your name, and it says "hello, john, today is feb, 3rd" (or whatever).
I'm not even sure if the code is right to do what I want to do, but I can't really figure that out if it won't compile.
Oh, and here is the error message I am getting.
HelloWorld.java:26: ')' expected
System.out.println ("Hello " + yourName
^
1 error
import java.util.*;
import java.io.*;
class HelloWorld extends Object
HelloWorld()
BufferedReader in = new BufferedReader (new
InputStreamReader(System.in));
Date currentDate = new Date();
String yourname;
System.out.println ("Hello, please enter your name: ");
yourName = in.readLine();
System.out.println ("Hello " + yourName
"Today is, " + currentDate );

At this point in your code a java.io.IOException might occur.
You have to declare your exception to be thrown:
HelloWorld() throws IOException Or you catch the occuring exception in a try-catch-block:
HelloWorld()
  try
   //your code here
  catch (IOException e)
   //What should be done with the exception
Guinevere                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Please help with simple Classes understanding

    Working further to understand Class formation, and basics.
    At the Java Threads Tutorial site:
    http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
    Goal:
    1)To take the following code, and make it into 2 seperate files.
    Reminder.java
    RemindTask.java
    2)Error Free
    Here is the original, functioning code:
    import java.util.Timer;
    import java.util.TimerTask;
    * Simple demo that uses java.util.Timer to schedule a task
    * to execute once 5 seconds have passed.
    * http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
    public class Reminder {
        Timer timer;
        public Reminder(int seconds) {
            timer = new Timer();
            timer.schedule(new RemindTask(), seconds*1000);
        class RemindTask extends TimerTask {
            public void run() {
                System.out.println("Time's up!");
                timer.cancel(); //Terminate the timer thread
        public static void main(String args[]) {
            new Reminder(5);
            System.out.println("Task scheduled.");
    }Here is what I tried to 2 so far, seperate into 2 seperate files:
    Reminder.java
    package threadspack;    //added this
    import java.util.Timer;
    import java.util.TimerTask;
    * Simple demo that uses java.util.Timer to schedule a task
    * to execute once 5 seconds have passed.
    * http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
    public class Reminder {
        Timer timer;
        public Reminder(int seconds) {
            timer = new Timer();
            timer.schedule(new RemindTask(), seconds*1000);
        public static void main(String args[]) {
            new Reminder(5);
            System.out.println("Task scheduled.");
    }and into
    RemindTask.java
    package threadspack;  //added this
    import java.util.Timer;
    import java.util.TimerTask;
    import threadspack.Reminder; //added this
    * http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
    public class RemindTask extends TimerTask
    Timer timer; /**here, I added this, because got a
    "cannot resolve symbol" error if try to compile w/out it
    but I thought using packages would have negated the need to do this....?*/
         public void run() {
                System.out.println("Time's up!");
                timer.cancel(); //Terminate the timer thread
    }After executing Reminder, the program does perform, even does the timing, however, a NullPointerException error is thrown in the RemindTask class because of this line:
    timer.cancel(); //Terminate the timer thread
    I am not sure of:
    If I have packages/import statements setup correctly
    If I have the "Timer" variable setup incorrectly/wrong spot.
    ...how to fix the problem(s)
    Thank you!

    Hi there!
    I understand that somehow the original "Timer" must
    be referenced.
    This is a major point of confusion for me....I
    thought that when importing
    Classes from the same package/other packages, you
    would have directly
    access to the variables within the imported Classes.I think you have one of the basic points of confussion. You are mixing up the concept of a "Class" with the concept of an "Object".
    Now, first of all, you do not need packages at all for what you are trying to do, so my advice is you completely forget about packages for the moment, they will only mess you up more. Simply place both .class files (compiled .java files) in the same directory. Your program is executing fine, so that indicates that the directory in which you have your main class file is being included in your classpath, so the JVM will find any class file you place there.
    As for Classes/Objects, think of the Class as the map in which the structure of a building is designed, and think of the Object as the building itself. Using the same technical map the architect defines, you could build as many buildings as you wanted. They could each have different colors, different types of doors, different window decorations, etc... but they would all have the same basic structure: the one defined in the technical map. So, the technical map is the Class, and each of the buildings is an object. In Java terminology, you would say that each of the buildings is an "Instance" of the Class.
    Lets take a simpler example with a class representing icecreams. Imagine you code the following class:
    public class Icecream{
         String flavor;
         boolean hasChocoChips;
    }Ok, with this code, what you're doing is defining the "structure" of an icecream. You can see that we have two variables in our class: a String variable with the description of the icecream's flavor, and a boolean variable indicating whether or not the icecream has chocolate chips. However, with that code you are not actually CREATING those variables (that is, allocating memory space for that data). All you are doing is saying that EACH icecream which is created will have those two variables. As I mentioned before, in Java terminology, creating an icecream would be instantiating an Icrecream object from the Icecream class.
    Ok, so lets make icrecream!!!
    Ummm... Why would we want to make several icecreams? Well, lets assume we have an icecream store:
    public class IcecreamStore{
    }Now, we want to sell icecreams, so lets put icecreams in our icecream store:
    public class IcecreamStore{
         Icecream strawberryIcecream = new Icecream(); //This is an object, it's an instance of Class Icecream
         Icecream lemonIcecream = new Icecream(); //This is another object, it's an instance of Class Icecream
    }By creating the two Icecream objects you have actually created (allocated memory space) the String and boolean variable for EACH of those icecreams. So you have actually created two String variables and two boolean variables.
    And how do we reference variables, objects, etc...?
    Well, we're selling icecreams, so lets create an icecream salesman:
    public class IcecreamSalesMan{
    }Our icecream salesman wants to sell icecreams, so lets give him a store. Lets say that each icecream store can only hold 3 icecreams. We could then define the IcecreamStore class as follows:
    public class IcecreamStore{
         Icecream icecream1;
         Icecream icecream2;
         Icecream icecream3;
    }Now lets modify our IcecreamSalesMan class to give the guy an icecream store:
    public class IcecreamSalesMan{
         IcecreamStore store = new IcecreamStore();
    }Ok, so now we have within our IcecreamSalesMan class a variable, called "store" which is itself an object (an instance) of the calss IcecreamStore.
    Now, as defined above, our IcecreamStore class will have three Icecream objects. Indirectly, our icecream salesman has now three icecreams, since he has an IcecreamStore object which in turn holds three Icecream objects.
    On the other hand, our good old salesman wants the three icecreams in his store to be chocolate, strawberry, and orange flavored. And he wants the two first icecreams to have chocolate chips, but not the third one. Well, here's the whole thing in java language:
    public class Icecream{ //define the Icecream class
         String flavor;
         boolean hasChocoChips;
    public class IcecreamStore{ //define the IcecreamStore class
         //Each icecream store will have three icecreams
         Icecream icecream1 = new Icecream(); //Create an Icecream object
         Icecream icecream2 = new Icecream(); //Create another Icecream object
         Icecream icecream3 = new Icecream(); //Create another Icecream object
    public class IcecreamSalesMan{ //this is our main (executable) class
         IcecreamStore store; //Our class has a variable which is an IcecreamStore object
         public void main(String args[]){
              store = new IcecreamStore(); //Create the store object (which itself will have 3 Icecream objects)
              /*Put the flavors and chocolate chips:*/
              store.icecream1.flavor = "Chocolate"; //Variable "flavor" of variable "icecream1" of variable "store"
              store.icecream2.flavor = "Strawberry"; //Variable "flavor" of variable "icecream2" of variable "store"
              store.icecream3.flavor = "Orange";
              store.icecream1.hasChocoChips = true;
              store.icecream2.hasChocoChips = true;
              store.icecream3.hasChocoChips = false;
    }And, retaking your original question, each of these three classes (Icecream, IcecreamStore, and IcecreamSalesMan) could be in a different .java file, and the program would work just fine. No need for packages!
    I'm sorry if you already knew all this and I just gave you a stupid lecture, but from your post I got the impression that you didn't have these concepts very clear. Otherwise, if you got the point, I'll let your extrapolate it to your own code. Should be a pice of cake!

  • Help on dynamically loading of simple classes - ClassLoader

    Hello,
    does somebody know how to load simple classes with java.lang.ClassLoader in a stateless session bean running on SneakPreview 6.40?
    i found many solutions for j2ee servers on the net but no one works. i always get a ClassNotFoundException but i can read the class file to a byte array.
    this is one way i tried to solve the problem:
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    Class aClass = Class.forName(strClassName, true, loader);
    hopefully someone can help me,
    thanks
    erich

    Hi Erich,
    for such a kind of problems (not knowing for sure where the classloader is looking for the class) I am used to use http://www.sysinternals.com/ntw2k/source/filemon.shtml
    Just write <i>Class.forName("ABC123", true, loader);</i> and then you can check the places where the classloader is looking for this ABC123 class...
    Hope it helps
    Detlev

  • Having trouble using a simple class..New to AS3

    Hello Everyone,
    I am new to AS3 but not to AS2. I have written a simple class
    and when I import it, I don't see the object that should be created
    upon calling the constructor. Can you guys tell me where am I going
    wrong. And I am very puzzled about 'document class'. Yes, I have
    google numerous threads on "document class" but still very shaky on
    this matter. Here is my simple class which should place a button
    object on the stage when I create a new object of this class.
    Once I have created the BTN class, I have made sure that I
    have button component in my library, I then instantiate the object
    by creating a new CS3 file and importing my class:
    import com.learning.as3.*;
    var b:BTN = new BTN();
    When I test the movie, I get the following errors:
    1172: Definition com.learning.as3 could not be found.
    1046: Type was not found or was not a compile-time constant:
    BTN.
    1180: Call to a possibly undefined method BTN.
    Any help would highly be appreciated.
    Thanks you.

    Hello Ned,
    Yes, I have made sure that my directory structure exist as it
    should be and yet I still get the errors.
    Thanks a lot.

  • Class definition

    hello, i need a class definition for a digital watch in Java.

    1. you'll pass 3 parameters into the constructor (1 for time, 1 for alarm, 1 for ...).
    2. your setTime and setAlarm methods will look something like this:
    void setTime(param)
    timeVariable = param;
    void setAlarm(param)
    alarmVariable = param;
    Simple as that. Hope this helps!!

  • Difference between narrow() method usage and simple class cast for EJB

    Hi,
    I have a very simple question:
    what is the difference between PortableRemoteObject.narrow(fromObj,
    toClass) method usage and simple class cast for EJB.
    For example,
    1)
    EJBObject ejbObj;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)PortableRemoteObject.narrow(ejbObj,ABean.class);
    OR
    2)
    EJBObject bean;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)ejbObj;
    Which one is better?
    P.S. I'm working with WL 6.1 sp2
    Any help would be appreciated.
    Thanks in advance,
    Orly

    [email protected] (Orly) writes:
    Hi,
    I have a very simple question:
    what is the difference between PortableRemoteObject.narrow(fromObj,
    toClass) method usage and simple class cast for EJB.
    For example,
    1)
    EJBObject ejbObj;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)PortableRemoteObject.narrow(ejbObj,ABean.class);
    OR
    2)
    EJBObject bean;
    // somewhere in the code the home.create() called for bean ...
    ABean a = (ABean)ejbObj;
    Which one is better?(1) is mandated by the spec. It is required because CORBA systems may
    not have sufficient type information available to do a simple case.
    P.S. I'm working with WL 6.1 sp2 You should always use PRO.narrow()
    andy

  • Best practice to handle the class definitions among storage enabled nodes

    We have a common set of cache servers that are shared among various applications. A common problem that we face upon deployment is with the missing class definition newly introduced by one of the application node. Any practical approach / best practices to address this problem?
    Edited by: Mahesh Kamath on Feb 3, 2010 10:17 PM

    Is it the cache servers themselves or your application servers that are having problems with loading classes?
    In order to dynamically add classes (in our case scripts that compile to Java byte code) we are considering to use a class loader that picks up classes from a coherence cache. I am however not so sure how/if this would work for the cache servers themselves if that is your problem!?
    Anyhow a simplistic cache class loader may look something like this:
    import com.tangosol.net.CacheFactory;
    * This trivial class loader searches a specified Coherence cache for classes to load. The classes are assumed
    * to be stored as arrays of bytes keyed with the "binary name" of the class (com.zzz.xxx).
    * It is probably a good idea to decide on some convention for how binary names are structured when stored in the
    * cache. For example the first tree parts of the binary name (com.scania.xxxx in the example) could be the
    * "application name" and this could be used as by a partitioning strategy to ensure that all classes associated with
    * a specific application are stored in the same partition and this way can be updated atomically by a processor or
    * transaction! This kind of partitioning policy also turns class loading into a "scalable" query since each
    * application will only involve one cache node!
    public class CacheClassLoader extends ClassLoader {
        public static final String DEFAULT_CLASS_CACHE_NAME = "ClassCache";
        private final String classCacheName;
        public CacheClassLoader() {
            this(DEFAULT_CLASS_CACHE_NAME);
        public CacheClassLoader(String classCacheName) {
            this.classCacheName = classCacheName;
        public CacheClassLoader(ClassLoader parent, String classCacheName) {
            super(parent);
            this.classCacheName = classCacheName;
        @Override
        public Class<?> loadClass(String className) throws ClassNotFoundException {
            byte[] bytes = (byte[]) CacheFactory.getCache(classCacheName).get(className);
            return defineClass(className, bytes, 0, bytes.length);
    }And a simple "loader" that put the classes in a JAR file into the cache may look like this:
    * This class loads classes from a JAR-files to a code cache
    public class JarToCacheLoader {
        private final String classCacheName;
        public JarToCacheLoader(String classCacheName) {
            this.classCacheName = classCacheName;
        public JarToCacheLoader() {
            this(CacheClassLoader.DEFAULT_CLASS_CACHE_NAME);
        public void loadClassFiles(String jarFileName) throws IOException {
            JarFile jarFile = new JarFile(jarFileName);
            System.out.println("Cache size = " + CacheFactory.getCache(classCacheName).size());
            for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
                final JarEntry entry = entries.nextElement();
                if (!entry.isDirectory() && entry.getName().endsWith(".class")) {
                    final InputStream inputStream = jarFile.getInputStream(entry);
                    final long size = entry.getSize();
                    int totalRead = 0;
                    int read = 0;
                    byte[] bytes = new byte[(int) size];
                    do {
                        read = inputStream.read(bytes, totalRead, bytes.length - totalRead);
                        totalRead += read;
                    } while (read > 0);
                    if (totalRead != size)
                        System.out.println(entry.getName() + " failed to load completely, " + size + " ," + read);
                    else
                        System.out.println(entry.getName().replace('/', '.'));
                        CacheFactory.getCache(classCacheName).put(entry.getName() + entry, bytes);
                    inputStream.close();
        public static void main(String[] args) {
            JarToCacheLoader loader = new JarToCacheLoader();
            for (String jarFileName : args)
                try {
                    loader.loadClassFiles(jarFileName);
                } catch (IOException e) {
                    e.printStackTrace();
    }Standard disclaimer - this is prototype code use on your own risk :-)
    /Magnus

  • LinkageError: duplicate class definition

    I am getting some error codes in my webserver log which I can't seem to figure out. I use IPlanet 6.0
    Has anyone seen this error before:
    [14/Feb/2002:16:36:29] failure ( 105): Internal error: Unexpected error condition thrown (unknown exception,no description), stack: java.lang.LinkageError: duplicate class definition: dnt/getNumbers
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:426)
         at com.iplanet.server.http.servlet.NSServletLoader.loadResource(NSServletLoader.java:387)
         at com.iplanet.server.http.servlet.NSServletLoader.loadClass(NSServletLoader.java:429)
         at com.iplanet.server.http.servlet.NSServletLoader.findClass(NSServletLoader.java:174)
         at com.iplanet.server.http.servlet.NSServletLoader.loadClass(NSServletLoader.java:106)
         at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.java:337)
         at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.java:173)
         at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:410)
    The interesting thing about this error is that it only happens when the thread is executing for the first time. Which is right after the web server has been started up.
    I've checked that all classes are in the classpath exacty once.
    I have no idea what is causing this.
    Any help would be very appreciated.
    Thank You.
    -Mike

    Hi,
    I hope you have added the classpath in the "context.properties" file, which will be in config directory of your server root directory. You need to restart the server after adding the classpath in the property file.
    Please send me your configuration files, 1)obj.conf 2)magnus.conf 3)error.log 4)jvm12.conf
    Senthil Babu J
    [email protected]

  • Duplicate class definition: oracle/jdbc/driver/OracleDriver

    Hi
    I using Jdeveloper 10.1.3.3 and I tried to add jdbc driver version 11.1.0.6.0 to Project by add Library to the project property. And I tried to run my application when step to connect database the program will occur the error.
    This below is the error
    500 Internal Server Error
    oracle.classloader.util.AnnotatedLinkageError: duplicate class definition: oracle/jdbc/driver/OracleDriver
         Invalid class: oracle.jdbc.driver.OracleDriver
         Loader: current-workspace-app.root:0.0.0
         Code-Source: /D:/oracle/jdbc/11/ojdbc5.jar
         Configuration: <library> in /D:/Jdev10133/jdev/mywork/Trainning/Trainning-oc4j-app.xml
         Dependent class: java.sql.DriverManager
         Loader: jre.bootstrap:1.5.0_06
         Code-Source: unknown
         Configuration: jre bootstrap
         at oracle.classloader.PolicyClassLoader.findLocalClass (PolicyClassLoader.java:1462) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.SearchPolicy$FindLocal.getClass (SearchPolicy.java:167) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.SearchSequence.getClass (SearchSequence.java:119) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.SearchPolicy.loadClass (SearchPolicy.java:645) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.PolicyClassLoader.askParentForClass (PolicyClassLoader.java:1289) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.SearchPolicy$AskParent.getClass (SearchPolicy.java:68) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.SearchSequence.getClass (SearchSequence.java:119) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.PolicyClassLoader.internalLoadClass (PolicyClassLoader.java:1674) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1635) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1620) [D:/Jdev10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@17332331]     at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319) [jre bootstrap, by jre.bootstrap:1.5.0_06]     at java.lang.Class.forName0 (Native method) [unknown, by unknown]     at java.lang.Class.forName (Class.java:242) [jre bootstrap, by jre.bootstrap:1.5.0_06]     at java.sql.DriverManager.getCallerClass (DriverManager.java:442) [jre bootstrap, by jre.bootstrap:1.5.0_06]     at java.sql.DriverManager.getConnection (DriverManager.java:519) [jre bootstrap, by jre.bootstrap:1.5.0_06]     at java.sql.DriverManager.getConnection (DriverManager.java:171) [jre bootstrap, by jre.bootstrap:1.5.0_06]     at com.util.Util.getConnection (Util.java:14) [D:/Jdev10133/jdev/mywork/Trainning/DBProgramming/classes/ (from <classpath> in D:\Jdev10133\jdev\mywork\Trainning\DBProgramming\public_html), by current-workspace-app.web.dbprogram:0.0.0]     at com.blob.BLOBTest.uploadFileToDB (BLOBTest.java:37) [D:/Jdev10133/jdev/mywork/Trainning/DBProgramming/classes/ (from <classpath> in D:\Jdev10133\jdev\mywork\Trainning\DBProgramming\public_html), by current-workspace-app.web.dbprogram:0.0.0]     at com.upload.doPost (upload.java:28) [D:/Jdev10133/jdev/mywork/Trainning/DBProgramming/classes/ (from <classpath> in D:\Jdev10133\jdev\mywork\Trainning\DBProgramming\public_html), by current-workspace-app.web.dbprogram:0.0.0]     at javax.servlet.http.HttpServlet.service (HttpServlet.java:763) [D:/Jdev10133/j2ee/home/lib/servlet.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by api:1.4.0]     at javax.servlet.http.HttpServlet.service (HttpServlet.java:856) [D:/Jdev10133/j2ee/home/lib/servlet.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by api:1.4.0]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke (ServletRequestDispatcher.java:713) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal (ServletRequestDispatcher.java:370) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.doProcessRequest (HttpRequestHandler.java:871) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.processRequest (HttpRequestHandler.java:453) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.serveOneRequest (HttpRequestHandler.java:221) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run (HttpRequestHandler.java:122) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run (HttpRequestHandler.java:111) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run (ServerSocketReadHandler.java:260) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run (ReleasableResourcePooledExecutor.java:303) [D:/Jdev10133/j2ee/home/lib/oc4j-internal.jar (from <code-source> in META-INF/boot.xml in D:\Jdev10133\j2ee\home\oc4j.jar), by oc4j:10.1.3]     at java.lang.Thread.run (Thread.java:595) [jre bootstrap, by jre.bootstrap:1.5.0_06]
    Please help to suggest me. How should I do to let out this error?
    Thanks

    many people use the two interchangeably, though technically it can mean something different.
    What you get back from a call to newInstance() is the same as what you'd get when using the new keyword and no constructor arguments, a reference to an instance of a class (there are other ways to dynamically create an instance using other constructors).
    "Creating a class object" technically means loading the class which causes a Class instance (so an instance of the class Class) to be created for that particular class, making the class available to the JVM for instantiation of instances.
    newInstance() and its sisters are useful for when the class to be instantiated is not known (or even doesn't exist) when compiling the class that needs to instantiate it.
    This is of course the case with JDBC. The people creating the JVM can't know what driver classes will be out there at some point in the future (and if they did know and have access to all of them in the past it would still be foolish to have them all hardwired into the JVM).

  • Simple Class

    I am looking for help in developing a simple program to track input and then convert the running total when prompted. I am a novice, I know I need to implement a simple class, then use an object to track data in the class. I have the input parameters setup with the if-else supporting it.
    Looking for an example of reading point that would assist. Like I said, this is a simple program, not in production, more training level
    Thanks

    Well basically I need to take the user input value
    and store it somewhere, continue to prompt for more
    input for an undetermined period, then when prompted,
    print out the running total.So, you don't know how to do any of that?
    Start here:
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

  • Help writing a class

    Trying to learn how to write a class. I had this AS for a
    video player that was working in my file and I am trying to learn
    how to move code like it into a class.
    I am doing what I think I need to, but am getting a bunch of
    errors that I don't know what to do with.
    My class starts like this and I am getting the following
    error:
    import mx.utils.Delegate;
    class VideoPlayer extends MovieClip{
    private var nc:NetConnection = new NetConnection();
    nc.connect(null);
    The nc.connect(null); part is giving me the following error
    message:
    "This statement is not permitted in a class definition."
    Why is that and how do I get around that?
    Thank you very much for any help!

    Ah, I get it. Sorry totally new to classes and having some
    issues with them...
    Thank you!!!

  • Please help!  Simple problem, I'm sure...

    Hi All!
    I would love any help anyone could provide on this. I have
    shied away from defining my own classes with Actionscript cause it
    seems so complicated, but I would feel very triumphant and
    confident if I could get this to work with your help. I have
    attached all code and Output.
    I would also love any advice on best coding practices if
    anyone sees anything in here that is technically wrong, even if it
    will work...
    Thanks!
    Graham

    that's right, the 1009 is being caused because at the point
    where the 'return' is in the getColor method, at the time when the
    call is made randomX and randomY have not yet been defined. I
    should have realized that in the first place :D and RR is right,
    it's much better to define the handler as a method of the class,
    rather than a 'nested' function.
    one thing that's still causing problems here - you are using
    the class to actually 'load' the image - it seems like the class
    should only 'target' an existing instance of the image (loader) and
    find the pixel value. in this case you could use the 'return'
    method to instantly 'grab' a pixel value - but as it is there is a
    delay while the image gets loaded, then 'finds' the pixel value.
    the problem here is that in the timeline you are asking for an
    'instant' return value - see the problem :)
    so, it seems to me that there are a couple of ways to go
    about it -
    1) instantiate the image load 'outside' the class and then
    use the class to target a random pixel 'after' the load is
    completed
    2) pass the variable instance to the class so that when the
    onComplete handler fires it assigns the value to the variable on
    the timeline.
    however in 2) there will still be a 'delay' in the
    processing, so the variable will not get defined for 'a little
    while' this may cause other problems in the operating code if you
    wish to use the value an time soon (by that i mean in terms of
    'program speed' which may only be milliseconds - but can be enough
    to cause other errors)
    I would go with the first option - keeping the class specific
    to 'getting the color' and do the loading outside the class - or
    even with another class. I would use the onComplete handler on the
    timeline to call the ColorGetter class method getColor() and pass
    the loader instance to that method, construct a quick bmp, and find
    the value.
    Your class structure looks pretty good - although i think
    that you should place the import statements outside the class
    definition within the package, as is common - and you should
    specify the 'var' types with either 'public' or 'private'
    as far as the 'return' type goes - whenever you designate a
    'return' statement that passes a value back to the calling
    statement, the 'type' must be designated in place of 'void' - this
    tells the compiler to operate the code and assign the value being
    returned to the variable where the call was made.

  • JAXB not generating correct class definition

    Hi,
    I am using JAXB 2.0 and the JAXB plugin for Eclipse 3.x.
    The problem I have is that when I run XJC on my XSD file the class definition for
    a particular class is not what I am expecting. The class only defines 1 get method instead of three. While I am expecting to see getX getY and getZ I am seeing only 1 method getXAndgetYAndgetZ. Here is a snippet of the XSD file:
         <xs:element name="Sql">
              <xs:complexType>
                   <xs:sequence minOccurs="0" maxOccurs="unbounded">
                        <xs:element name="Query"/>
                        <xs:element ref="Table" maxOccurs="unbounded"/>
                        <xs:element name="Database" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>I have defined the Table element in the XSD.
    In this case my generated Sql class has the following method:
    public List<JAXBElement<String>> getQueryAndTableAndDatabase() {
            if (queryAndTableAndDatabase == null) {
                queryAndTableAndDatabase = new ArrayList<JAXBElement<String>>();
            return this.queryAndTableAndDatabase;
        }Is there a problem with my XSD file or am I omitting a parameter when running XJC? Any help greatly appreciated

    LDAPLoginModule uses the jackrabbit UserManagerImpl to create user's in CRX (CQ), not the CQ5 implementation which is disappointing. Have to manually add the sling:resourceType.

  • Assistance needed regarding a Class Definition Error:

    I've checked online tutorials, asked friends, tried other forums, IRC, online contacts, and NO ONE can help me at this. I've been stuck on it for hours, and I'm beyond the point of frustration, as I'm about 98% complete without this error. I get it when I try to access a file from the command prompt:
    Exception in thread "main" java.lang.NoClassDefFoundError: MiniTriangle
    Everyone tells me it's a Class Definition error. While this is good to know, no one seems to know how to fix it. So I'm here hoping someone knows an answer which could work for this. I sincerely thank you all for your help in advance!

    This will likely be nonsense, lol
    Well..I compiled it in Jcreator, 2 files packed together:
    package myprojects.minitriangle;
    The java files are in the C:\java directory, but they're separate from the compiler since I couldn't get there with the command prompt (Invalid folder name)

  • Duplicate class definition: org/apache/jasper/runtime/HttpJspBase

    I am getting a duplicate class definition in an web server class. I have no idea how to solve this, besides the errors appears only sometimes...
    Any ideas ???
    duplicate class definition: org/apache/jasper/runtime/HttpJspBase
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:484).

    I'm getting exactly the same problem and I can't see a proper solution.
    I would appreciate any help.
    Thanks,
    Mauro.

Maybe you are looking for

  • Game Center multiple devices

    My husband has a game on the iPad under my Game Center account. I have the same game on my phone. How do I get my game on my iPhone to replace his on the iPad? Once my game level is higher than his, will it automatically ask to load my game?

  • Trouble installing Photoshop CS3 on a new computer with Windows 8.1

    I tried to install it but strange things happened. It shows up on the install/uninstall list but not on the desktop or My PC. I found CS3 on my new computer by accident when I called up an unrelated file. The computer wants me to take CS3 on a 30 day

  • SQL Server data tools 71561

    I'm tearing my hair out with error 71561 in relation to views referencing objects in a different database, I have added the referenced database in as a dacpac but this has made no difference whatsoever, despite the referenced objects being inside the

  • External (dynamic) IP not refreshed automatically?

    Hi all. Is WRT54G (v.6) supposed to refresh the external IP every time my ISP's DHCP changes it? My ISP (Rogers, Canada) started changing IP-s daily, it's become really annoying that I have to refresh the IP manually on the router every day. I have t

  • Shared tenchologies files failed in reinstall of adobe photoshop elements 10

    My Adobe Elements 10 both photoshop and premiere suddenly stopped opening up, or would open to menu page then disappear.I deactovated to uninstall photoshop and tried to install it again. it failed saying the shared technologies files failed. Now I c