OIM Java task code example

Hello,
I need to create a process task which must do a SELECT statement on a remote Oracle database (for which I created a IT Resource of type Database) in order to retrieve some values. Can anybody provide me a code example of similar things?
Regards,
Adrian

Ya it's easy
Re: How to get ITResource to Adapter?
There is one more API getITAssetProperties of tcUtilXellerateOperations which give you all the values in a map.
Hashtable itResourceTable = tcUtilXellerateOperations.getITAssetProperties(dataProvider,itresourceName);
And dataProvider you can get from Adapter as a variable.

Similar Messages

  • OIM java api code

    what is DB in code line below, how and where should it be declared:
    userIntf=(tcUserOperationsIntf)ioUtilityFactory.getUtility(*db*,"Thor.API.Operations.tcUserOperationsIntf");

    moSignature = tcCryptoUtil.sign("xelsysadm", "PrivateKey");
                   utilFactory = new tcUtilityFactory(env, moSignature);
    tcRequestOperations requestOperations = (tcRequestOperations) utilFactory.getUtility("Thor.API.Operations.tctcRequestOperationsIntf");
    No db.. Remove that db..

  • How to invoke a Java Custom Code after creating a resource in OIM Console

    Greetings.
    I want to invoke a custom code after creating the resource "OID User" on the OIM Administration Console. For example invoke a custom code that creates The Form's resource access descriptor (RAD) on the OID.
    I have read the Developer's Guide for Oracle Identity Manager book but I don't get how to solve my requirement.
    Should I use a "Java Task" on the design Console?
    Could Anybody provide me the detailed steps to do that?
    Thanks
    Ramiro Ortíz.

    Greetings.
    I want to invoke a custom code after creating the resource "OID User" on the OIM Administration Console. For example invoke a custom code that creates The Form's resource access descriptor (RAD) on the OID.
    I have read the Developer's Guide for Oracle Identity Manager book but I don't get how to solve my requirement.
    Should I use a "Java Task" on the design Console?
    Could Anybody provide me the detailed steps to do that?
    Thanks
    Ramiro Ortíz.

  • How to read the Java source code (in Netbeans)

    I use OS X10.5.5, NetBeans 6.1 and JSE 6 on a 64 bit mac.
    When I downloaded NB6.1 it had JSE 5 as it's default (and only) java platform. I ran Software Update to get Java 6 from Apple, used the Java Prefrences utitlity to set JSE6 as default. In NB I added the JDK6 platform, registered the JDK6 javadocs and noticed that I also have the option of registering the Java source code.
    I have three questions:
    1) How do I make JDK6 the default in NetBeans. The JDK5 keeps being default after I did the steps above and I don't see anywhere to change that.
    2) How do I read the Java 6 source code? I can see sun provides [source code| http://download.java.net/jdk6/] for their supported platforms. I dont see Apple doing the same for its JDK port. What would I need to do to get to read the java SE6 sources? or is it actually hiding somewhere in the /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home hierarchy?
    3) Where does the JVM look for the binary code to run when I make a call to, say java.util.ArrayList or any other library. In my naivety I would have assumed it would be a .class file somewhere in the java Home folder, but I don't see anything like it.
    thanks in advance,
    chris

    This is taken from the help included with netbeans. In response to question 1.
    By default, the IDE uses the version of the Java SE platform (JDK) with which the IDE runs as the default Java platform
    for compilation, execution, and debugging. You can view your IDE's JDK version by choosing Help > About and clicking the
    Detail tab. The JDK version is listed in the Java field.
    You can run the IDE with a different JDK version by starting the IDE with the --jdkhome jdk-home-dir switch on the command line
    or in your IDE-HOME/etc/netbeans.conf file. For more information, see IDE Startup Parameters.
    In the IDE, you can register multiple Java platforms and attach Javadoc and source code to each platform. For example, if you
    want to work with the new features introduced in JDK 5.0, you would either run the IDE on JDK 5.0 or register JDK 5.0 as a
    platform and attach the source code and Javadoc to the platform.
    In  , you can switch the target JDK in the Project Properties dialog box. In  , you have to set the target JDK in the Ant script itself,
    then specify the source/binary format in the Project Properties dialog box.
    To register a new Java platform:
    Choose Tools > Java Platforms from the main window.
    Click New Platform and select the directory that contains the Java platform. Java platform directories are marked with a  
    in the file chooser.
    Use the Sources and Javadoc tabs to attach Javadoc documentation and source code for debugging to the platform.
    Click Close.
    To set the default Java platform for a standard project:
    Right-click the project's root node in the Projects window and choose Properties.
    In the Project Properties dialog box, select the Libraries node in the left pane.
    Choose the desired Java platform in the Java Platform combo box.
    Switching the target JDK for a standard project does the following:
    Offers the new target JDK's classes for code completion.
    If available, displays the target JDK's source code and Javadoc documentation.
    Uses the target JDK's executables (javac and java) to compile and execute your application.
    Compiles your source code against the target JDK's libraries.
    If you want to register additional Java platforms with the IDE, you can do so by clicking the Manage Platforms button.
    Then click the Add Platform button and navigate to the desired platform.
    To set the target Java platform for a free-form project:
    In your Ant script, set the target JDK as desired in the javac, java, and javadoc tasks.
    Right-click the project's root node in the Projects window and choose Properties.
    In the Sources panel, set the level of JDK you want your application to be run on in the Source/Binary Format combo box.
    When you access Javadoc or source code for JDK classes, the IDE searches the Java platforms registered in the
    Java Platform Manager for a platform with a matching version number. If no matching platform is found, the IDE's default platform is used instead.
    See Also
    Managing the Classpath
    Declaring the Classpath in a Free-Form Project
    Stepping Through Your Program
    Legal Notices

  • Handling exception logging in a Java task scheduler program?

    I need to design a Task Scheduler Where
    1) User should be able to schedule multiple task at the same time.
    2) There should be proper error handling on failure of any task and should not affect the other running tasks.
    I found the related programme at http://www.roseindia.net/java/example/java/util/CertainAndRepeatTime.shtml
    My concern is about handling of point 2 in program provided at above link. Say I schedule a recurring mail send process in above program which will be run first time on 12 september 2011 at 2 am, and will be repeated after every 2 hours Say a one process fais at 8 am. I want to log it in log file with task name and time details. Now if I look at above programme i.e CertainAndRepeatTime.java. This program will exit once it schedules all the tasks. Where and how should handle the logging?
    Posted at http://stackoverflow.com/questions/7377204/handling-exception-logging-in-a-java-task-scheduler-program but folks suggesting Quartz scheduler . My Limitation is that i can't for quartz because my project allows me to use only standard java library. Is there any way we can handle logging in the same programme in case of exception.

    Well, first of all I wouldn't trust any code from roseindia. So you might want to look for more reliable advice.
    As for your logging, you can add it for example to the TimerTask itself. I don't recommend adding logging to that roseindia cr*p though.

  • How to get a handle of tcUtilityFactory within Java Task

    Hi
    I am trying to user op interface within a java task and want to avoid the GUI based coding in adapter factory
    I am having doubt about how to get a handle of tcUtilityFactory
    the standalone example of getting the handle works fine within a Java task
    // ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    // final Hashtable env = config.getAllSettings();
    // ioUtilityFactory = new tcUtilityFactory(env, "xelsysadm", "welcome1");
    but I want the handle to be provided by adapter runtime env
    there is a function call within generated adapter code
    APITaskLocal.getUtilityFactory(getDataBase());
    but I get null pointer if I try to use it within custom code
    has anyone played around with APITaskLocal.getUtilityFactory

    Hi,
    Use this code.
    public void init(tcDataProvider dataProvider) {
    try {
         usrOps = (tcUserOperationsIntf)tcUtilityFactory.getUtility(dataProvider, "Thor.API.Operations.tcUserOperationsIntf");
    } catch(Exception e) {
    log.error("Unable to initialize: "+e);
    You can pass dataProvider in adapter mapping . Map it to Adapter reference->Database reference.
    Hope this will help.
    Regards
    Nitesh

  • Java Script Code not working properly for visios in sharepoint 2013

    Hi all ,
                 I have few visios and I am using the visio web part to display and to redirect from one visio to other visio I am using the java script code through content editor web part . 
    In share point 2010 it's working fine , I was able to redirect to all the visios and code is working fine .
    In share point 2013 its not the same , Its not working properly . only for the first time the code is working fine . once it goes to next visio the code stops working . 
    For example if i click in visio A it gets redirect to Visio B and its stops working , it wont allow to do any other steps . 
    I have checked with the URL its correct , I am not able to find any error also .
    Indresh

    This will be likely caused by the Minimal Download Strategy not registering the Javascript on the page reload. You can turn off the MDS feature to test this.
    You can either turn off MDS in your site, or register your Javascript functions with MDS to ensure they are called. To do this, you'll need all of your code to be wrapped in a javascript file (Embed this on the page using a <script> tag and
    inside that file in a function, which you then register with MDS as follows (I usually do this in the first line of the javascript file):-
    RegisterModuleInit("/SiteAssets/YourJavaScriptFile.js", NameOfYourFunction);
    Regards
    Paul.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

  • Custom OIM java client not working

    Hi all,
    I am trying to execute a custom OIM java client in my server. The java file just has the code to connect to the OIM server and it is failing at the line
    ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    The basic content of the java file OIMTry.java is given below:
    env.put("java.security.auth.login.config", "/u01/apps/resetpwd/config/auth.conf");
    env.put("java.security.policy", "/u01/apps/resetpwd/config/xl.policy");
    env.put("XL.HomeDir", "/u01/apps/resetpwd");
    ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    env = config.getAllSettings();
    I have set the OIM related jar files in classpath in .bash_profile and able to echo the classpath as well.
    However, the file is executing perfectly in Eclipse tool but not from command prompt.The file is getting compiled properly at command prompt.
    I have tried various options of executing the java file as shown below.
    java -Djava.security.manager -DXL.HomeDir=/u01/apps/oim_server/xellerate -Djava.security.policy=/u01/apps/oim_server/xellerate/config/xl.policy -Djava.security.auth.login.config=/u01/apps/oim_server/xellerate/config/auth.conf -Djava.naming.provider.url=jnp://oim_server_host:12401/ OIMTry
    java -Dclasspath=/u01/apps/resetpwd/lib/xlUtils.jar:/u01/apps/resetpwd/lib/xlAPI.jar:/u01/apps/resetpwd/lib/xlCrypto.jar OIMTry
    The error we are getting is given below:
    Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: com.thortech.xl.util.config.ConfigurationClient
    at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
    at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
    at JvResolvePoolEntry(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
    at OIMTry.main(java.lang.String[]) (Unknown Source)
    Caused by: java.lang.ClassNotFoundException: javax.crypto.Cipher not found in [file:/u01/apps/resetpwd/lib/activation.jar, file:/u01/apps/resetpwd/lib/ojdbc14.jar, file:/u01/apps/resetpwd/lib/XLCustomClient.ear, file:/u01/apps/resetpwd/lib/commons-beanutils.jar, file:/u01/apps/resetpwd/lib/oscache.jar, file:/u01/apps/resetpwd/lib/xlDataObjectBeans.jar, file:/u01/apps/resetpwd/lib/commons-collections.jar, file:/u01/apps/resetpwd/lib/sax.jar, file:/u01/apps/resetpwd/lib/xlDataObjects.jar, file:/u01/apps/resetpwd/lib/commons-dbcp-1.2.1.jar, file:/u01/apps/resetpwd/lib/wlXLSecurityProviders.jar, file:/u01/apps/resetpwd/lib/xlDDM.jar, file:/u01/apps/resetpwd/lib/commons-digester.jar, file:/u01/apps/resetpwd/lib/xalan.jar, file:/u01/apps/resetpwd/lib/xlGenConnector.jar, file:/u01/apps/resetpwd/lib/commons-logging.jar, file:/u01/apps/resetpwd/lib/XellerateClient.jar, file:/u01/apps/resetpwd/lib/xlGenericUtils.jar, file:/u01/apps/resetpwd/lib/commons-pool-1.2.jar, file:/u01/apps/resetpwd/lib/xercesImpl.jar, file:/u01/apps/resetpwd/lib/xliGCProviders.jar, file:/u01/apps/resetpwd/lib/commons-validator.jar, file:/u01/apps/resetpwd/lib/xerces.jar, file:/u01/apps/resetpwd/lib/xlInputPreprocessor.jar, file:/u01/apps/resetpwd/lib/crimson.jar, file:/u01/apps/resetpwd/lib/XIMDD.jar, file:/u01/apps/resetpwd/lib/xlInstaller.jar, file:/u01/apps/resetpwd/lib/csv.jar, file:/u01/apps/resetpwd/lib/XL10SecurityProviders.jar, file:/u01/apps/resetpwd/lib/xlLogger.jar, file:/u01/apps/resetpwd/lib/dom.jar, file:/u01/apps/resetpwd/lib/xlAdapterUtilities.jar, file:/u01/apps/resetpwd/lib/xlRemoteManager.jar, file:/u01/apps/resetpwd/lib/ejb.jar, file:/u01/apps/resetpwd/lib/xlAPI.jar, file:/u01/apps/resetpwd/lib/xlRequestPreview.jar, file:/u01/apps/resetpwd/lib/jakarta-oro-2.0.8.jar, file:/u01/apps/resetpwd/lib/xlAttestation.jar, file:/u01/apps/resetpwd/lib/xlSampleApp.jar, file:/u01/apps/resetpwd/lib/javagroups-all.jar, file:/u01/apps/resetpwd/lib/xlAuditor.jar, file:/u01/apps/resetpwd/lib/xlScheduler.jar, file:/u01/apps/resetpwd/lib/jaxp-api.jar, file:/u01/apps/resetpwd/lib/xlAuthentication.jar, file:/u01/apps/resetpwd/lib/xlUtils.jar, file:/u01/apps/resetpwd/lib/jhall.jar, file:/u01/apps/resetpwd/lib/xlBackOfficeBeans.jar, file:/u01/apps/resetpwd/lib/xlVO.jar, file:/u01/apps/resetpwd/lib/log4j-1.2.8.jar, file:/u01/apps/resetpwd/lib/xlBackofficeClient.jar, file:/u01/apps/resetpwd/lib/xlWebClient.jar, file:/u01/apps/resetpwd/lib/mail.jar, file:/u01/apps/resetpwd/lib/xlCache.jar, file:/u01/apps/resetpwd/lib/xlWSCustomClient.jar, file:/u01/apps/resetpwd/lib/oc4jclient.jar, file:/u01/apps/resetpwd/lib/xlCrypto.jar, file:/u01/apps/resetpwd/lib/xml-apis.jar, file:/usr/share/java/libgcj-3.4.6.jar, file:./, core:/]
    at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
    at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
    at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0)
    at JvFindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
    at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
    at JvBytecodeVerifier.type.compatible(_Jv_BytecodeVerifier.type&, JvBytecodeVerifier) (/usr/lib/libgcj.so.5.0.0)
    at JvBytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.5.0.0)
    at JvVerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.5.0.0)
    at JvPrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
    at JvWaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
    at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
    at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
    ...3 more
    Please let me know if I have to set something else in the environment to get rid of this error.
    Thanks,
    Mahendra.

    Hi,
    We were unable to create tcUtilityFactory instance when the env variables are set using the hashmap.
    Instead it is working when we set using System.setProperty() as shown below:
    System.setProperty("XL.HomeDir", "/u01/apps/OIMPwdReset");
    System.setProperty("java.security.policy", "/u01/apps/OIMPwdReset/config/xl.policy");//server or client
    System.setProperty("java.security.auth.login.config", "/u01/apps/OIMPwdReset/config/auth.conf");//server or client
    Hope this helps other guys..
    -Mahendra.

  • [code] does not work correctly, cannot post code example.

    Hi, I tried to do a code example, but HTML tags inside java quoted strings were intereperted. Like the <IMG> tag and the <H1> tag..
    How do I prevent this????
    Re: How to post an audio file in JSP or servlet

    OK, it was the IMG and H1 tags....
    Looks like I can embed an image though <img src="http://www.oracle.com/admin/images/ocom/oralogo_small.gif">

  • Beginner Question | The use of modulus in this simple code example.

    Hello everyone,
    I am just beginning to learn Java and have started reading "Java Programming for the absolute beginner". It is quite a old book but seems to be doing the trick, mainly.
    There is a code example which I follow mostly but the use of the modulus operator in the switch condition doesn't make sense to me, why is it used? Could someone shed some light on this for me?
    import java.util.Random;
    public class FortuneTeller {
      public static void main(String args[]) {
        Random randini = new Random();
        int fortuneIndex;
        String day;
        String[] fortunes = { "The world is going to end :-(.",
          "You will have a HORRIBLE day!",
          "You will stub your toe.",
          "You will find a shiny new nickel.",
          "You will talk to someone who has bad breath.",
          "You will get a hug from someone you love.",
          "You will remember that day for the rest of your life!",
          "You will get an unexpected phone call.",
          "Nothing significant will happen.",
          "You will bump into someone you haven't seen in a while.",
          "You will be publicly humiliated.",
          "You will find forty dollars.",
          "The stars will appear in the sky.",
          "The proper authorities will discover your secret.",
          "You will be mistaken for a god by a small country.",
          "You will win the lottery!",
          "You will change your name to \"Bob\" and move to Alaska.",
          "You will discover first hand that Bigfoot is real.",
          "You will succeed at everything you do.",
          "You will learn something new.",
          "Your friends will treat you to lunch.",
          "You will meet someone famous.",
          "You will be very bored.",
          "You will hear your new favorite song.",
          "Tomorrow... is too difficult to predict" };
        System.out.println("\nYou have awakened the Great Randini...");
        fortuneIndex = randini.nextInt(fortunes.length);
        switch (randini.nextInt(7) % 7) {   
          case 0:
            day = "Sunday";
            break;
          case 1:
            day = "Monday";
            break;
          case 2:
            day = "Tuesday";
            break;
          case 3:
            day = "Wednesday";
            break;
          case 4:
            day = "Thursday";
            break;
          case 5:
            day = "Friday";
            break;
          case 6:
            day = "Saturday";
            break;
          default:
            day = "Tomorrow";
        System.out.println("I, the Great Randini, know all!");
        System.out.println("I see that on " + day);
        System.out.println("\n" + fortunes[fortuneIndex]);
        System.out.println("\nNow, I must sleep...");
    }

    randini.nextInt(7) % 7randini.nextInt(7) returns a value in the range 0 <= x < 7, right? (Check the API!) And:
    0 % 7 == 0
    1 % 7 == 1
    2 % 7 == 2
    3 % 7 == 3
    4 % 7 == 4
    5 % 7 == 5
    6 % 7 == 6Looks like superfluous code to me. Maybe originally they wrote:
    randini.nextInt() % 7Note this code has problems, because, for example -1 % 7 == -1

  • Code Examples

    Are there any good code examples around that show how to capture video on client A and broadcast it over the network to client B which then plays it?
    Thanks, in advance.

    You can see media4j project in http://media4j.dev.java.net
    There is an audiochat sample and others more.

  • A code example

    Hi,
    I'm quite new at Java (and at programming on the whole). Can someone explain this to me (saw it in an code example on the internet):
    final private char PI_NAME = 0xFF01;
    /M

    Hi,
    a char is a variable that is supposed to contain a
    character. However, not all characters exist on the
    keyboard, so you define them using their hex value.
    final private char PI_NAME = 0xFF01;final = no one can change it
    private = no one can see it
    char = see above
    PI_NAME = the name of the variable
    0xFF01 = the value of the variable in hexadecimal
    Generally, in Java you can define any number using
    octal, decimal or hexadecimal numbers
    Octals (based on the number 8, which means it has
    digits from 0 to 7) ALWAYS start with a leading 0,
    decimals are entered as you know them (for example
    17) and hexadecimal numbers are entered with a
    leading 0x.
    So in this case 0x means "hexadecimal number ahead",
    FF01 is its value.
    To know its value in decimal, do the following:
    1 x 1 (value of last digit)
    0 x 16 (value of second from last)
    15 x 16 x 16 (F in hex represents the decimal 15)
    15 x 16 x 16
    All in all, this results in the decimal number
    65281.

  • OIM - Scheduled Tasks - Validade/Enable

    Hi All,
    I am quite new to OIM, two days working with it, and I have some questions that seem to be easy to answer but I could not find it here, neither on the internet (or I am not using the correct keywords).
    In our OIM environment we have some custom recon scheduled tasks, developed by oracle, and, as our internal processes with the targets are not working properly still, sometimes the scheduled tasks fail and when they fail they got disabled too. Most of the times they fail is because its input file, a CSV file coming from a target, is not there.
    Based on it, my questions are:
    1. I know there is a way to list all scheduled tasks and their status using the API, check this link: http://www.rameshgk.com/blog/2010/09/23/oim-scheduled-task-for-monitoring-other-scheduled-tasks/, but is there a way to do it by command line in Unix?
    2. Is there a way, when the schedulted tasks got disabled due to a failure, to enable it automatically, via API or any other method, without the need to go to web client?
    I was forgetting to comment one thing, unfortunately, I don't have access to the OIM database!
    Thanks for your attention!
    Regards.

    You can execute the scheduled task from the command line and use the following API:
    void updateScheduleTask(long scheduledTaskKey,
    java.util.Map attributes)
    throws Thor.API.Exceptions.tcAPIException,
    Thor.API.Exceptions.tcScheduledTaskNotFoundException,
    Thor.API.Exceptions.tcInvalidAttributeException,
    Thor.API.Exceptions.tcAttributeMissingException,
    tcAPIExceptionUpdates schedule task information based on the attribute that are passed to this method
    Parameters:
    scheduledTaskKey - the scheduled task key
    attributes - a map of updated attributes valid attributes
    •Task Scheduler.ClassName
    •Task Scheduler.Disable
    •Task Scheduler.Frequency Type
    •Task Scheduler.Interval
    •Task Scheduler.Key
    •Task Scheduler.Last Start Time
    •Task Scheduler.Last Stop Time
    •Task Scheduler.Max Retries
    •Task Scheduler.Name
    •Task Scheduler.Next Start Time
    •Task Scheduler.Retry Count
    •Task Scheduler.Start Time
    •Task Scheduler.Status
    You can provide the Frequency Type and Next Start Time and then it should be picked up. Just like when you are in the design console and you have it set to run once and you clear the entries in the time and set it to the current one.
    -Kevin
    Please don't forget to give points where earned on helpful posts.

  • Error running code examples from Training Video

    I am currently learning Java and I am using a Java Training series from Sun. There are several code examples that I am having problems running. I am 99.9% sure that my code is correct. That is the code that I have followed along and written.
    Here is an example of code that I am trying to run. ( I am on OS X 10.5 BTW )
    public class Person
         public int ageYears = 32;
         public void calculateAge()
              int ageDays = ageYears * 365;
              long ageSeconds = ageYears * 365 * 24L * 60 *60;
              long ageMinutes = ageSeconds / 60;
              long ageMilliseconds = ageSeconds * 1000;
              System.out.println("You are " + ageDays +  " days old.");
              System.out.println("You are " + ageSeconds + " seconds old.");
              System.out.println("You are " + ageMinutes + " minutes old.");
              System.out.println("You are " + ageMilliseconds + " milliseconds old.");
    }After I create the file (which is named Person.java) I open the terminal and cd to the directory the file is in. In my terminal I first say
    javac Person.java
    I don't get any errors at all. Then I try to run the program like this.
    java Person
    When I try this I get the following error
    Exception in thread "main" java.lang.NoSuchMethodError: main
    I am not sure why I get this error. On the instruction video the instructors code seams to run just fine with out have a main function. The instructor is on Windows and I am not sure if that has anything to do with it or not?
    Any thoughts or suggestions would be really helpful.

    mswallace wrote:
    I am currently learning Java and I am using a Java Training series from Sun. There are several code examples that I am having problems running. I am 99.9% sure that my code is correct. That is the code that I have followed along and written. Trust what the compiler and the JVM say to you.
    I am not sure why I get this error. On the instruction video the instructors code seams to run just fine with out have a main function. The instructor is on Windows and I am not sure if that has anything to do with it or not?
    Any thoughts or suggestions would be really helpful.So, as the error is asking you, where is the main method that every runnable program must have? This has nothing to do with windows and everything to do with all programs needing a main method to run (even applets where the main method is I believe within the Applet class code).

  • Help: Calling C++ method in Java source code?

    I found a method very useful, but it is written in C++, really hate to translate it into Java. My questions are:
    1. Is it possible to call it in my java source code?
    2. If so, how to call the C++ method in my Java program?

    To answer your first question, yes it is possible to call your C++ method from Java. There are several answers to your second question, however. You can use the raw procedural JNI and code your own layer that maps your Java proxy object instances to C++ peer instances. Another option is to generate the code for that mapping automatically. How? Download JNI++ (http://jnipp.sf.net or http://www.sf.net/projects/jnipp). JNI++ is a free, open-source toolkit that makes easy work of bi-directional Java <---> C++ integration -- it will even generate your makefile. Comes complete with a 100-page printable PDF User Guide and plenty of examples to get you started.
    Good luck with your project.
    I found a method very useful, but it is written in
    C++, really hate to translate it into Java. My
    questions are:
    1. Is it possible to call it in my java source code?
    2. If so, how to call the C++ method in my Java
    program?

Maybe you are looking for

  • Help/Question with Reinstall  OSX 10.2.1 on iBook G4

    First off...I just want to say that if someone can take the time to assist me I would appreciate it more than you know! Now...on to my issue: History: I have a iBook G4 running, I think on either 10.3 or 10.4 (I can't tell you now because it won't st

  • Cannot apply down-payment to sales tax

    Dear All, Our customer created a Down-payment for a client, say, $105. $100 is the amount of the product, $5 is the sale tax (GST). Then he created a sales order. The total before discount is $100, tax is $5, total sales order is $105. When he copied

  • Add a second address book

    Does anyone know of an address book app that can be added to my Curve that won't confuse the syncing of the phone?  My current contact list is synced with my office address book (via sync NOT server, which seems to be a problem) and I want to be able

  • JAXB: How to have my generated classes subclass some other outside class ?

    With my XJS and DTD, JAXB generates the following: public class FraisMessage     extends MarshallableRootElement     implements RootElement { etc...I would like it to generate this instead: public class FraisMessage extends MyOtherClass     extends M

  • New iSight

    PB G4 17 laptop, 1.33 GHz, 1.5 GB Ram, Tiger 10.4.7 Plugged in the iSight right out of the box and get the green light but no video. When I try iChat I get the message "camera is in use by another application" there is of course nothing else running