Can't call or execute of different class files in a main program

Hi, I got a main program which can call 3 different classes. The main program have an implicit-choice List as a starting menu. If one of the file is selected, the files will call out and display it. However, i managed to call the 1st 2 files, and the 3rd files can't display anything after selected.
I enclosed my code as below:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Catalogues extends Form implements CommandListener {
     private Displayable parent;
     private Display display;
     private List Cata;
     private Boots bo;
     private Higheels hHeels;
     private Sandals sand;
     private Slippers sp;
    private Command backCommand = new Command("Back", Command.BACK, 1);
    private Command viewCommand = new Command("View", Command.SCREEN, 1);
    private String[] options = {"Boots", "High Heels","Sandals", "Slippers"};
     public Catalogues(Display d, Displayable p) {
          super("Welcome to Footwear World");
          Cata = new List("Select Option", List.IMPLICIT, options, null);
          display = d;
        parent = p;
          addCommand(backCommand);
          addCommand(viewCommand);
          setCommandListener(this);
     public void commandAction(Command c, Displayable d) {
     if(d==parent && c==List.SELECT_COMMAND){
          switch(parent.getSelectedIndex()){
               case 0:
                       if(bo==null){
                          bo = new Boots(display,parent);
                         display.setCurrent(bo);
                          break;
               case 1:
                       if(hHeels==null){
                          hHeels = new Higheels(display,parent);
                         display.setCurrent(hHeels);
                          break;
               case 2:
                       if(sand==null){
                          sand = new Sandals(display,parent);
                         display.setCurrent(sand);
                          break;
               case 3:
                       if(sp==null){
                          sp = new Slippers(display,parent);
                         display.setCurrent(sp);
                          break;
               default:
         else if (c==backCommand) {
                   display.setCurrent(parent);
}If the 3rd option is selected, i'll display above mentioned layout which contain a list to select too.
After build this project on WToolkit. It shown an error message which is as below:
Project settings saved
Building "SelectCustest"
C:\WTK22\apps\SelectCustest\src\Catalogues.java:29: cannot resolve symbol
symbol : method getSelectedIndex ()
location: class javax.microedition.lcdui.Displayable
switch(parent.getSelectedIndex()){
^
1 error
com.sun.kvem.ktools.ExecutionException
Build failed
May i know what is problem am i facing now? And how to solve it.
Thanks.

Thanks to all for your thoughts and replies. I liked the xargs suggestion, so I tried that first. I would have (may still) try the stdin suggestion, followed by writing the grep output to a file.
xargs does work, in a way I didn't expect it to, but that could be due to my inexperience with the workings of the shell.
here's a line from my test script
cat file | grep foo | xargs java com.company.test.TEchoArghere's the contents of 'file'
123foo
abc
qafoozv
qaz
wsx
qwefoort
zxcfooh
sdfghhere's the output from the test class, which just echos any arguments
::number of args: 4
::args[0] 123foo
::args[1] qafoozv
::args[2] qwefoort
::args[3] zxcfoohso xargs appends all the values from grep into an argument list and call the java class once.
when I took xargs out of the script, nothing was passed to the class:
::number of args: 0this was really interesting and something to keep in my back pocket for future use.
Thanks again to all.
Tom

Similar Messages

  • Can we call and execute a request set using db adapter or oracle apps adapt

    Hi,
    Can we call and execute a request set(which executes a set of packages in a sequence) using db adapter or oracle apps adapter similar to calling a stored procedure and concurrent program?
    thanks,
    RV

    1) In BPEL call the DBAdapter in a sequence, make sure you set the partnerlink 'property' to transaction=participate.
    2) Or create a package that calls the other packages in a sequence
    Marc
    http://orasoa.blogspot.com

  • Hi , my problem is that i can only create absolute links to other pdf-files in a main pdf-file. how can i switch to or create relative links. Thanks for help!

    Hi , my problem is that i can only create absolute links to other pdf-files in a main pdf-file. how can i switch to or create relative links. Thanks for help!

    I’m using version 11.0.10. So where the Menu resides in a folder ready to be burnt on to a CD, that same folder is where the links point to.
    Thanks

  • How can I call a variable from another class

    hi
    If I have two classes : one and two
    In class two I have a variable called : action
    In class one I want to check what is the value of action.
    How can I call action?

    Thank you scorbett
    what you told me worked fine, but my problem is that MyClass2 is an application by itself that I don't want to be executed.
    Creating myClass2 as in the following:
    MyClass2 myClass2 = new MyClass2();
    [/code]
    executes myClass2.
    Can I prevent the exectuion of MyClass2, or is there another way to call the variable (action)?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • In .jar file how can I call API's of other .Jar file

    Hi all,
    I have created a "MyApplication.jar" file that dose not need any other .jar file Like xercesImpl.jar thne it is working fine.
    but If I make the .jar file of application that needs xercesImpl.jar API's
    of this .jar file then how I can call that xercesImpl.jar in my Application.jar newly created.
    please help me
    Thanks in advance.

    either add the other jar file to your classpath or do the following (taken from http://javaalmanac.com/egs/java.lang/LoadClass.html)
    e68. Loading a Class That Is Not on the Classpath
    A URLClassLoader can be used to load classes in any directory.
        // Create a File object on the root of the directory containing the class file
        File file = new File("c:\\myclasses\\");
        try {
            // Convert File to a URL
            URL url = file.toURL();          // file:/c:/myclasses/
            URL[] urls = new URL[]{url};
            // Create a new class loader with the directory
            ClassLoader cl = new URLClassLoader(urls);
            // Load in the class; MyClass.class should be located in
            // the directory file:/c:/myclasses/com/mycompany
            Class cls = cl.loadClass("com.mycompany.MyClass");
        } catch (MalformedURLException e) {
        } catch (ClassNotFoundException e) {
        }

  • How to call java methods from different java file.

    Hi, i create 2 files:
    CircleCalculationMethod.java
    Main.java
    In Main.java, How can i call method in CircleCalculationMethod.java ?
    Should i put everything in same folder ??
    Should i do something like "import CircleCalculationMethod.java"
    Should i do something like create a package
    Thanks
    P/S: i use Eclipse software

    As I suggested in your OTHER threads - the BEST WAY to learn, and often the fastest, is to TRY THINGS yourself.
    Just posting code you get from the internet and asking others to modify it for you won't teach you anything.
    Go through The Java Tutorials. There are trails for ALL of the basic functionality that include working, sample code.
    This is the trail on 'Packages':
    Lesson: Packages (The Java™ Tutorials > Learning the Java Language)
    And this is the one on 'Classes and Objects'. This trail includes sections for methods and how to define and use them.
    Lesson: Classes and Objects (The Java™ Tutorials > Learning the Java Language)

  • How can I allow a sub-vi to run independent of the main program once it has been called while still sending data to the sub-vi

    I have a main program where I call a sub-vi. In this sub-vi, there is a while loop that is used to wait for commands in the sub-vi. While the while loop is running, I cannot continue with normal operation of the main program. I would like get the sub-vi to run independently once it has been called, but not hold up the main program. As well, I need to still be able to send data to the sub-vi

    One way is to use VI Server, which has been mentioned by others. This will allow you to start another VI (by name) and run it entirely independently of the calling VI. This is a good way to start various independent VIs from a main menu, for example. None of the VIs thus called need have any connection to the others.
    Another way it to have the SubVI in a separate while loop on the calling VI's BD. Then, use a local var to start this sub VI from the main loop. The calling VI sets a local START bit and continues running. The sub VI's while loop watches for this START bit to go true, and then runs the Sub VI. The advantage here is that one can more easily pass arguments to the SubVI when it is started, using local vars, which are preferable to globals. Once the Su
    bVI is running, however, you must use a global Stop Bit, set in the calling VI, to stop it when the calling VI exits, or the calling VI will hang up, waiting for the Sub VI to close and exit its while loop.
    If you need an example of this, email me. ([email protected]). I can also recommend Gary W. Johnson's excellent book which discusses this. ("LabVIEW Graphical Programming", 2nd Ed).
    Note: Where possible, I try to call a subvi from within the main VI, wait till it is done, then continue. It avoids the use of locals & globals, and results in cleaner code, with fewer "race" conditions. However, the main VI stops until the subVI is done, hence one should make the subVI modal.

  • How can I hide constant variable value in class file?

    hi,everybody.
    I am having a problem with constant variable which define connectted with database(URL,username,password).
    when I used UltraEdit to open class file, I can see constant variable value.
    Thanks!

    OK, let's see. Firstly, if I may correct your terminology, the phrase "constant variable" is a paradox (I think that is the right word). You have either one of the other. You declaration is either 'constant' or 'variable' (ie: it can change at run-time or it doesn't). People often use the term 'variable' and 'declaration' interchangably which is where the confusion lies.
    Anyway, onto the real problem. It seems that you want to protect your connection details (in particular the password, I would guess). Unfortunately, Java compiles not to machine-code, but byte-code which is semi-human-readable. So people, if they are inquisitive enough, will always be able to see it if they try hard enough.
    You can do one of two things:
    (1) Get an 'obfusticator'. An obfusticator is something that you run over Java source files and it completely messes it up (without modifying functionality). You then compile and the original source is such gibberish that the byte-code is very difficult to understand. However, the password will still be in there somewhere.
    (2) Don't put sensitive information into your source. Have this kind of info in external files (encrypted) and allow your class to read this file, decrypt, and use it.
    Hope that helps.
    Ben

  • Can LabVIEW call a function from a .sys file or is LabVIEW limited to dll access?

    My vendor has sent me a .sys file with functions accessing their hardware.  Can i call these function from labview directly or do I have to wrapper the .sys with a dll?

    Well a sys file is a kernel device driver. LabVIEW does not have any direct way of accessing such a driver. The way kernel drivers are accessed is usually through a DLL which makes calls to WinAPI functions such as CreateFile(), ReadFile(), WriteFile(), CloseHandle() and DeviceIORequest(). Since these WinAPI calls are basically just DLL calls too, you could theoretically use the Call Library Node to call them and access the kernel device driver in such a way.
    However for any kernel device driver with more than one or two device driver calls, it will certainly be easier in terms of development, debugging and maintenance of the code, to write actually a dedicated DLL in C/C++ for this device driver and access that DLL from LabVIEW, especially if you consider the LabVIEW datatype limitations when designing the DLL interface (Basically this same DLL can then be called from any other Windows development environment, be it Visual Basic (similar datatype limitation as LabVIEW), Delphi, (Visual) C, LabVIEW or also various scripting environments like Python and Lua.
    Some of the necessary WindAPI calls are rather involved and pose quite a bit of trouble to get the parameter data right in LabVIEw.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Call a method of a class file from an Applet

    I have an Applet nmaed CountDown.java in which I have to call a method "doSelect" of a class file named DBConnection.java. How do I do this? Both the Applet and the class file are in the same directory.

    You should put both classes in the same package and create a jar file containing the whole package.
    Make sure the DBConnection class is public or protected and that the method you're trying to call is public or protected.

  • I can compile java, but I cannot run class file.

    Exception in thread "main" java.lang.NoClassDefFoundError: Demonstrate
    That is the error I get when I type: java Demonstrate
    I have "C:\j2sdk1.4.0\bin" in the path for the Environment Variables in windows xp. I've even tried to insert that into a CLASSPATH several ways and it does not change the error.
    javac Demonstrate.java works fine. That compiled file can work on other computers. Because of that, I do not think it's a setting error. Any ideas ? Thanks for any help.

    Microsoft problem? I like nothing better than bashing M$, but this sounds like a CLASSPATH problem to me.
    I'll assume that your Demonstrate.java does NOT have a package statement in it and has a main method that you'd like to run. If so, you compile like this:
    javac Demonstrate.javaThe result is a Demonstrate.class file in the same directory as Demonstrate.java.
    Now, type this in the command shell right in the directory where Demonstrate.class lives to run it:
    java -classpath . DemonstrateYou won't get that ClassNotFoundException.
    Whenever you see that exception, it means you don't have your CLASSPATH set properly. - MOD
    You won't get ta

  • Can It Be Done? - Using Java Class Files from a DB

    Hello,
    I am interested in storing a binary java class file in my oracle DB. Then I want to get it out at runtime and execute methods on it. I am planning on casting the object to an interface and executing the methods within. Please let me know if this is possible and where to look for more info, and a code example would be awesome.
    Joe
    [email protected]

    I think you are going to need to serialize the objects and the classes. (Don't get stuck on semantics here, I don't mean use Java Serialization to write the Class instance, I am referring to writing the .class file to a field in the database.) Obviously the instances are what you are interested in (since you mentioned casting them to interfaces and invoking methods on them), but the class definitions will need to either be available already, or stored elsewhere in the database.

  • Java .class files - Moving the Main Class .class file to a new location

    Novice question....so much so that I hope it's even coherent...
    In a Java program which references many associated .class files (e.g. bicycleMain.class, bicycleSub1.class, bicycleSub2.class, etc....), do the associated .class files always have to be located in the same directory as the Main .class file?
    What I'm getting at is - If I've developed an application consisting of several .class files on my own Windows PC and I want to put the compiled application out on our Windows File Server so that anyone can execute my application, how would I go about doing this?
    Say I put the compiled .class files in H:\PROJECTS\JAVA\COMPILED\, will other people be able to execute the application from their PCs by simply issuing the command line:
    'java h:\projects\java\compiled\bicycleMain'
    Any insights would be very helpful in getting me oriented. Thanks in advance.

    Interesting...so are you saying the command line might look something like this:
    java -classpath h:\projects\java\compiled bicycleMain
    And if I want other people to be able to execute the application without specifying the -classpath option then they would need to manually update the ClassPath environment variable on their individual PCs first?

  • Generation .class file  for Java Concurrent Program

    Hi
    Below if my sample java concurrent program code and registered concurrent program
    package oracle.apps.sample;
    import 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, "");
    Created a sample directory under $JAVA_TOP: $ mkdir $JAVA_TOPoracle/apps/fnd/cp/sample
    Copied Hello.java into $JAVA_TOP/oracle/apps/fnd/cp/sample and ran below command to compile
    $ cp $HOME/Hello.java $JAVA_TOP/oracle/apps/fnd/cp/sample
    But getting error
    javac: file not found: /oracle/apps/fnd/cp/sample
    Usage: javac <options> <source files>
    use -help for a list of possible options
    Please suggest what was issue and is there any option to generate class file in J developer in local (Windows) instead of doing on application server if yes what are steps to be followed to generate class in windows
    Thanks
    Arjun

    Please post the details of the application release, database version and OS.
    But getting error
    javac: file not found: /oracle/apps/fnd/cp/sample
    Usage: javac <options> <source files>
    use -help for a list of possible optionsHow do you get this error?
    Thanks,
    Hussein

  • Calling a method from different class

    Hey peeps,
    say i have a method in another class and i wish to call it, what would the code be for that?
    say for example the method was called createNewShoeBox and i was in another class?
    hope that makes sence

    jermaindefoe wrote:
    lol! id love to have one, and in which case would love to have the money for one as id definatley take it up,In the following part, you're saying you're a student. So there are peers you can ask, if not your professor. There are certainly also some who actualy know some programming and would teach you if you just asked them.
    im a first year student bear in mind though lol!!! and ma struggling, I see that, and the way you handle your problems, that won't change for the next few years.
    i may not be as good at java as you, but i can do other things better than you can, and thats life, we all have to start somewhereWhat you also can't do as well as I do is "realizing that using an internet forum is one of the worse ways to have people helping you to learn programming". You're lacking a lot of understanding for concepts where the label "basic" is almost exaggerating. I'm sure you can get that understanding, but being spoon-fed through a forum with no visible effort to figure things out is not the way to do it.

Maybe you are looking for

  • Identifying Execute Queue Threads as Socket Readers

    Hi All, Preface: I am trying to identify at any given instance the percentage of socket reader threads that are in use - this will help me to identify when all threads are in use and unable to service user requests. Thus my goal is to identify thread

  • After getting the Cirrus developer key what is the next step To connect to the Cirrus service in php

    i have generated the developer key and now i want to connect to the Cirrus service, open an RTMFP NetConnection to rtmfp://p2p.rtmfp.net using your developer key as the first connection parameter in php

  • Standard Task not sending internet Mail to SAP User

    Through Standard Task TS00007989(Outbound, error handling with IDoc) able to send workitems to SAP Inbox when an error occurs in IDOC, however would like to have these workitems sent as an internet mail , the email address would be in my userid in SA

  • Statistics in Numbers?

    I'm trying to do statistics in Numbers, specifically t tests. In EXCEL, I could generate p-values and using tinv function, identify the relevant table values of t (to compare to my calculated t). Anyone know how to do this in Numbers?

  • BlackBerry software will NOT install onto Vista Ultimate!?

    Hi Anyone, I've repetely tried installing the BlackBerry software to my new OS Vista Ultimate on my new custom built PC but it just wont take.  I've used my CD instillation disk and I've used the BlackBerry site latest download.  It jsut won't take.