How to run java from another directory

hi,
i have a Sample.java file in F drive(f:/Sample.java). I opened command prompt in windows and went to c: drive and try to compile as
C:\>javac f:/Sample.java
above command works well. it generated Sample.class file in F:/Sample.
But, when i try to Run that file, i got the error as follow.
C:\>java f:/Sample
Exception in thread "main" java.lang.NoClassDefFoundError: f:/Sample
Caused by: java.lang.ClassNotFoundException: f:.Sample
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: f:/Sample. Program will exit.
Please guide me to run java file from another directory

Thanks a lot. I appreciate your answer
But, when i try to run the java program.. below message has been displayed, showing how to use the command with options....
I didn't get the result of java program.
c:\>java f:\Sample.java
C:\>java -cp f:\Sample
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
C:\>

Similar Messages

  • How to run Java from Firefox Extension using liveconnect?!

    Hi, I'm trying to run a very simple java program from a Firefox extension I'm making but I've run into a brickwall and just can't get it to work. I'm a complete beginner in java and don't know much javascript so I've copied and pasted code from around the net to get where I am now. I'm sure I'm just making some stupid error at some step.
    In order to work out what I'm misunderstanding/doing wrong I'd be really grateful if someone could show me how to get it to work using a very basic example:
    Say I have a .java file taken from the sun pages:
    * The HelloWorldApp class implements an application that
    * simply displays "Hello World!" to the standard output.
    class HelloWorldApp {
        public static void main(String[] args) {
            System.out.println("Hello World!"); //Display the string.
    }So I stick it into a jar using:
    jar.exe cvfe HelloWorldApp.jar HelloWorldApp.class HelloWorldApp.class
    I then place it directly on my C: drive.
    In the javascript of my firefox extension I have code copied and pasted from https://developer.mozilla.org/en/Java_in_Firefox_Extensions:
    var urlClasz = java.lang.Class.forName("java.net.URL");
    var urlArray = java.lang.reflect.Array.newInstance(urlClasz,1);
    urlArray[0] = new java.net.URL('file:///C:/HelloWorldApp.jar');
    var cl = java.net.URLClassLoader.newInstance(urlArray);
    var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
    var aStaticMethod = aClass.getMethod("HelloWorldApp", []);
    var greeting = aStaticMethod.invoke(null, []);This seems to start java but then only gives me the error:
    "Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.ClassNotFoundException: HelloWorldApp]."
    I would be infinitely grateful if someone could show me the code I would use in this situation to run the HelloWorldApp. If I could get it working in this basic situation I'm sure I could work it out from there.
    Thank you very, very much!!

    By the way, I answered just because nobody did and I have some experience with using java from mozilla javascript.
    But I never played with Firefox extensions.
    No problem baftos, I understand you might not have all the answers but you've helped loads so far, so thanks a lot! I've found it very difficult to find good documentation on this for a beginner like me.
    Adding public did it (although I thought that I'd tried that, oops) so thanks again for that. I may have a couple of other questions just in case you happen to know the answer!
    I'd like to send some string arguments to the method I really want to run eg:
    public class HelloWorldApp {
    public static void sayHello(String[] args)
    {code}After googling .forName and .getMethod to see how to pass parameters I've added some code:
    {code:java}
    var strClass = java.lang.Class.forName("java.lang.String");
    var parameters = java.lang.reflect.Array.newInstance(strClass,2);
    parameters[0] ="My string argument";
    parameters[1] ="3"; // etc...
    var argHolder = java.lang.reflect.Array.newInstance(strClass,1);
    argHolder[0] = strClass;
    var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
    var aStaticMethod = aClass.getMethod("sayHello", argHolder);
    var greeting = aStaticMethod.invoke(null, parameters);
    {code}What I thought I was doing was creating a java array: argHolder and putting the string class/object thingy?! in it so that getMethod would look for a method called "sayHello" which took a string array as an argument... but apparently not!
    This brings me back to square one with a cannot find method with these arguments error:
    "Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.IllegalArgumentException: No method found matching name getMethod and arguments [java.lang.String, [Ljava.lang.String;]]."
    You don't happen to know how to do this as well do you?!
    Edited by: mzatanoskas on Feb 13, 2009 1:40 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to run java program from website?

    Hello
    I'd like to know how to run java program from my web page.
    I'd like to push some button in this web page so java program that would be on my server
    would pop-up. Can it be done automaticaly upon running this web site? (without any buttons - I just enter website and program pops up).
    Cheers

    I rather thought about RMI. But I could try servlets. So how it would look like?.
    I would make http request in browser (enter address) and program would show up in its window?. And I would not have to change anything in my program?. This program would run then on both boxes?. One remotely and one not?.
    But I would have to learn some basics, I've never worked with servlets. Could you suggest some good sites about it?. With ready examples so I could tweak them to my purpose.
    Message was edited by:
    macmacmac

  • How to run expdp from client ?

    Hi All,
    I tried searching google and forums for my issue but to no avail > How to run expdp from client side ....like in my laptop.
    Because currently our PROD database server has no space for expdp dump file. So I want it directed to my laptop which has an extenal USB of 1TB harddisk...via client EXPDP
    import data using impdp command
    Posted on: 08-May-2012 11:36, by user: 841731 -- Relevance: 53% -- Show all results within this thread
    below command is correct or not? if it is not correct could you please send me the correct command. impdp user/pass@databasename schemas=sourceschemaname remap_schema=sourceschemaname:destinationschemaname ...
    System generated Index names different on target database after expdp/impdp
    Posted on: 30-May-2012 11:58, by user: 895124 -- Relevance: 43% -- Show all results within this thread
    After performing expdp/impdp to move data from one database (A) to another (B), the system name generated indexes has different ...
    [ETL] TTS vs expdp/impdp vs ctas (dblink
    Posted on: 08-May-2012 21:10, by user: 869578 -- Relevance: 39% -- Show all results within this thread
    (table : 500 giga, index : 500 giga), how much faster is TTS (transportable tablespace) over expdp/impdp, and over ctas (dblink) ? As you know, the speed of etl depends on the hardware capacity. (io ...
    Oracle Client
    Posted on: 21-Jun-2012 22:47, by user: Sh**** -- Relevance: 32% -- Show all results within this thread
    Hi Guys, Please can you guys elaborate the difference between Oracle Client and Oracle Instant Client. Also, please can you advise from where I can download the Oracle normal ...
    Oracle 10g Client
    Posted on: 05-Jun-2012 10:11, by user: dzm -- Relevance: 26% -- Show all results within this thread
    to search at oracle site and this forum, but i wasn't able to find a link to download the oracle 10g client. I really need especificaly the 10g version. Anybody know the link or another way to download ...
    9i client to access 11g database
    Posted on: 22-Jun-2012 07:31, by user: kkrm333 -- Relevance: 24% -- Show all results within this thread
    Hi, Can i access a 11g database using 9i client? Thanks,
    SQLplus in Oracle Client
    Posted on: 14-Jun-2012 00:36, by user: Tim B. -- Relevance: 24% -- Show all results within this thread
    Hi, I tried to install an 11g oracle client in linux. As I've compared the files with the files when you install using the oracle instant ...
    Re: Information on Oracle Client 11202-1.1.4-6
    Posted on: 05-Jun-2012 03:33, by user: 898763 -- Relevance: 23% -- Show all results within this thread
    Actually thats the client requirement
    Analysing the performance of a single client
    Posted on: 28-Mar-2012 02:05, by user: 880172 -- Relevance: 23% -- Show all results within this thread
    timeouts even on some of the simplest queries. I want to try and get some data about how just this one client is performing and what it’s doing, but everything Google has thrown up so far is orientated around ...
    to make client connection as sys
    Posted on: 12-Jun-2012 22:04, by user: user11221081 -- Relevance: 23% -- Show all results within this thread
    Dear gurus can i connect to my server from my client machine with sysdba without giving sys password i have connected in different ways as sys@abc ...Thanks a lot.

    Though you can initiate the binary from your client side but for the file creation, there is no other way but to store it on the server side. So your best bet would be to get some space free on the server side of yours.
    Aman....

  • How to run notepad from a web application

    hi
    can any body know,how to run notepad from a web application under tomcat

    You already asked this question:
    http://forum.java.sun.com/thread.jspa?threadID=5150005&messageID=9561597
    Obviously running notepad on the clients PC is not possible (ignoring active x)

  • How to run java using xcode?

    i have to install "java developer " but i can't find, where i can run Java, Please give me information about "how to run java use xcode " ?

    Download the SDK from Oracle, code, enjoy.

  • Need to run midlet from another midlet

    Need to run midlet from another midlet
    How to do it?
    In my midlet user get link to web-page, and i want to start mobile browser with this page.

    Hi,
    In order to run midlet from another midlet you may use push registry. Go through the API of that I am not sure but as far as I know push registry is the only solution to that
    Sunil
    Software Developer - J2ME

  • How to run java servlet without using Web.xml?

    How to run servlet without using Web.xml? From a book, I know that web.xml descriptor is optional, but the book doesn't tell us how to run java servelet without web.xm descriptor. So how to do that? Thanks a lot.

    How to run servlet without using Web.xml?But Tomcat now uses a web.xml for its global server-wide configuration.
    If you'd like to invoke a servlet with:
    http://host/servlet/ServletName
    you have to enable the invoker servlet.
    [from an HTML]
      <FORM METHOD="POST" ACTION="/servlet/HGrepSearchSJ">
    [from resin.conf of Resin Web Server 2.1.12]
      <!--
         - The "invoker" servlet invokes servlet classes from the URL.
         - /examples/basic/servlet/HelloServlet will start the HelloServlet
         - class.  In general, the invoker should only be used
         - for development, not on a deployment server, because it might
         - leave open security holes.
        -->
      <servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
    [from TOMCAT5.0.19/conf/web.xml, a global server-wide web.xml file]
      <!-- The "invoker" servlet, which executes anonymous servlet classes      -->
      <!-- that have not been defined in a web.xml file.  Traditionally, this   -->
      <!-- servlet is mapped to URL pattern "/servlet/*", but you can map it    -->
      <!-- to other patterns as well.  The extra path info portion of such a    -->
      <!-- request must be the fully qualified class name of a Java class that  -->
      <!-- implements Servlet (or extends HttpServlet), or the servlet name     -->
      <!-- of an existing servlet definition.     This servlet supports the     -->
      <!-- following initialization parameters (default values are in square    -->
      <!-- brackets):                                                           -->
      <!--                                                                      -->
      <!--   debug               Debugging detail level for messages logged     -->
      <!--                       by this servlet.  [0]                          -->
        <servlet>
            <servlet-name>invoker</servlet-name>
            <servlet-class>
              org.apache.catalina.servlets.InvokerServlet
            </servlet-class>
            <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
        </servlet>
    ---comment out below----------------------------------------------------------
        <!-- The mapping for the invoker servlet -->
    <!--
        <servlet-mapping>
            <servlet-name>invoker</servlet-name>
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    -->

  • How to copy images from another MC in reversed order??

    Hi everyone,
    I'm new to AS3 and have been fighting and searching for a solution to this problem for a week now, and I'm VERY close!
    I crated a MC holding of a series of images (about 50) and I jump around in it using plenty AS3 scripts (most of which I don't fully understand yet, but I'm working on that to! )
    I had to find a way to "rewind" (= play backwards) the MC. Since there is a stop(); command in almost every frame, prevFrame does not work and if I put that in a loop, it goes WAY to fast (but worked).. So I could think of only one way...
    Create a new (reverserd) MC with the same image sequence ald reverse it manually and play that one.
    This all works fine (very proud of it ).
    Now my question:
    To get this to work for multiple image sequences, I have to load all images twice (once in MC_1 and again in MC_2 and select them and reverse them).
    Not a big one, unless you want to create MANY of those SWF's...
    Is it possible to load the 50 images of the first MC in reverse into the second MC dynamically? JUST the images, noting else.
    extra info: the MC_2 is already in the lib(empty) and placed on the stage.
    something like:
    var pointer:Number=1;
    for (var:i:Number=50;i>=0;i--) {
    get MC_1.picure(var);
    put it in MC_2.frame(pointer);
    pointer = pointer + 1;
    All help is welcome and please take into account that I have little experience and copy most of my scripting from people like you
    T.I.A.
    Melluw

    I tried your advice (thanks for that)
    The event I already have is the mouse leave
    I //-d out the part I removed (what did work)
    The code I ended up with is:
    function Start() {
    stage.addEventListener(Event.MOUSE_LEAVE, cursorHide);
    function cursorHide(evt:Event):void {
    var currFrame = MC_1.currentFrame;
    if (CCW == true) {  //it is true in this case
      movStart = (50 - currFrame);
    else {
      movStart = currFrame;
    if (movStart>25) {
      MC_1.prevFrame();
    // removed swapChildren(MC_1, MC_2); // This is the part I removed
    // removed MC_2.gotoAndPlay(movStart);
    else {
      MC_1.gotoAndPlay (movStart);
    And if I leave the stage on the part where movStart is indeed >25
    Nothing happens,
    So I guess this is not what you meant
    Subject: Action Script 3 how to copy images from another MC in reversed order??
    I cannot direct you in the loading of the images approach, it will be too complicated, and will probably not work anyways... when you move away from a frame that has dynamic content, you lose the content.  So basically, there is nothing practical in taking that approach.
    I do niot understand what the problem will be with the enterFrame/prevFrame approach. If everything you can do with the mouse is already used (which I doubt) by the first mc, then there is nothing else you can do with this file.  You probably just need to rethink your control scheme.  You should search Google for "AS3 slideshow tutorial", and to lighten up your design, add "XML" in that search.
    >

  • How to run java signed applet in vista with changing IE security options

    how to run java signed applet in vista with changing IE security options. If i change the IE security settings to low. it works.
    without changing the security setting, how to run.

    j_nanaji9 wrote:
    how to run java signed applet in vista with changing IE security options. If i change the IE security settings to low. it works.
    without changing the security setting, how to run.Can't be done without changing the security setting.

  • HT204350 Incorrect link to "OS X: How to migrate data from another Mac using Mountain Lion and earlier"

    Incorrect link to "OS X: How to migrate data from another Mac using Mountain Lion and earlier". Should be http://support.apple.com/kb/HT6025

    I think the OP is saying OS X: How to migrate data from another Mac using Mountain Lion and earlier (which should be a link to HT4889) just links back to OS X: How to migrate data from another Mac using Mavericks (HT5872).
    It does indeed do that, & HT4889 seems to be MIA.

  • How to run report from form using run_object_report

    I AM USNING FORMS9I/REPORTS 9I , HOW TO RUN REPORT FROM FROM USING RUN_REPORT_OBJECT AND HOW
    TO PASS PARAMETER AS WE DID IN RUN_REPORTS PLEASE HELP ME

    here an example !
    I hope this example you can use it
    PROCEDURE pr_reporte IS
    BEGIN
    DECLARE
         repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status Varchar2(20);
    d1 DATE;
    d2 DATE;
    BEGIN
         d1 := :GLOBAL.DIA_INI;
         d2 := :GLOBAL.DIA_FIN;
         repid := find_report_object('rep_lab02');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'p_fec_uno='||to_char((add_months(last_day(d1),-1) +1),'DD/MM/YYYY')||' '||
         'p_fec_dos='||to_char(d2,'DD/MM/YYYY'));
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
         v_rep := RUN_REPORT_OBJECT(repid);
         rep_status := report_object_status(v_rep);
         WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED') LOOP
              rep_status := report_object_status(v_rep);
         END LOOP;
         IF rep_status = 'FINISHED' then
              WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver','_blank');
         ELSE
              ventana('E','error reporte no encontrado','S');
         END IF;
    END;
    END;
    The 'rep_lab02' is the name of the report that you give in the node reports
    p_fec_uno and p_fec_dos they are the parameters in the report
    repserver is the name of server created with rwserver
    Greetings

  • How to run workflow from Developer studio ?

    Hi Guys,
    I searched for a work item type in the developer studio and it showed the results, but could not find out how to run it from there.. I know we can run it from there.. There is no run button or options available.
    Do i need to setup some profile options ?
    Any help in this is highly appreciated !!
    Thanks,
    Sathish

    Hi,
    Are you logged in as the Workflow Administrator or a user who has been assigned that responsibility?
    Have a look on the Administration tab and it will show you who is configured as the admin.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://www.workflowfaq.com/blog ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • How to Run scenario from the web using HTTP web page?

    Hi guys
    Please let me know How to Run scenario from the web using HTTP web page?
    Regards
    Janakiram

    Hi Janakiram,
    ODI provides web based UI for running the scenarios using Metadata Navigator (read only of ur ODI components) and Lighweight designer (u can edit the mapping here).
    Please explore how to install metadata navigator in ODI and have a look at ODI Setup document for more information.
    Thanks,
    Guru

  • How to run import from Unix Oracle 8.0.5 database with Windows Oracle client?

    How to run import from Unix Oracle 8.0.5 database via network with Windows Oracle client? Is it possible? When I try to do it Oracle client just hangs... If not which ones are compatible Aix or Solaris to Unix or it must be a Unix client to connect to Unix Oracle database. Thank's for any help.

    Hi,
    In our project we are using this type. Since in this project server in UNIX(DEC) and client is running on windows. We have created a listener which always listen requests from client and doing the according to the request.
    Step1. create a request table, where u are inserting ur request.
    step2. create PRO*C proram, which is listening request on the table. If there is any request, call the imp (executable). This is happening on server side.
    Benifit. U can make a request from cleint and ftp the file client sit.
    Are u interested in more details and code, pls send a mail to me
    ---- Boby Jose Thekkanath
    [email protected]
    Dharma Computers(p) Ltd. Bangalore.
    null

Maybe you are looking for

  • Cannot see Business Objects Repository in SAP production server from Worskpace - SMP 2.3

    Hi all, I have problems with reading RFC from production server, because BOR isn't visible at all in Mobile Workspace. Maybe I do something wrong so let me explain what am trying to accomplish. I need to make applications work on production server. U

  • Position a UI element or container on a specific position in webdynpro ABAP

    Hi All, How can we positioned different UI elements on a specific location?. I mean whenever we drag and drop them on a view they seem to take their place automatically. Is there a way to give them a shape ( vertical/horizontal ) & position explicitl

  • Problem in opening Xcelsius file

    Hi, I had created a dashboard. I am now not able to open the file. Gives an error "Crystal xcelsius is unable to load this file. This file may be corrupt or have features that cannot be supported by this version of crystal reports". Then gives an err

  • Profit centre creation - how to default CCs unchecked?

    Hello When I create a profit centre (ECC6.0), all company codes are assigned by default.  This means that I must de-select all of the company codes which I don't want assigned, which is onerous since we have many company codes, and only wish to have

  • Adding more memory...

    Hello everyone. I currently own a 15" MacBook Pro w/ a single 512MB RAM. I use a lot of Adobe products (I'm a Graphic Design major), and unforetunately they all run under Rosseta. Now, I don't know if it's hella slow because of Rosseta, or the memory