Cannot Execute .java File..

Hi,i'm really confused about this..it's so weird..
i'm trying to execute (.java) file from another directory, but
it can't,why? if i just compile that file from another directory
there's no problem with that...
ex : i have file named Hello.java which i save it on C:\Work
i compile this file like this :
     C:\javac C:\Work\Hello.java
there's no problem when i compile that file, but when i try to
execute that file i got this messages :
Exception in thread "main" java.lang.NoClassDefFoundError: C:\Work\Hello
this is how i execute that file : C:\java C:\Work\Hello
if i execute like this : C:\Work\java Hello, there's no problem..
Why (.java) file cannot be execute from another directory...
Thanks a lot..

It considers the pathname to be part of the class name when you do it like that, and since you don't have a class named C:\Work\Hello (and can't, since you can't use colons or backslashes in the name), that's not gonna happen.
Try this:
java -classpath C:\Work\ Hello
Note the space between C:\Work\ and Hello. Hope that helps :)

Similar Messages

  • Could not stop SDM server. Cannot execute Java process for stopSDM with parameters 50018

    dear SAP
    i have a system Solman 7.1
    i'm upgrading Solman from SP04 to SP13 using SUM (SP12 patch 10) on windows 2012
    and i faced  error  during  Excution phase 5.6  in JAVA Stack.
    phase : Excution - Actual Update
    Error : An error has occurred during the execution of the Deploy software components step.
    Could not stop SDM server. Cannot execute Java process for stopSDM with parameters 50018. Return code condition success evaluated to false for process java.exe for action ACTION_STOP
    You can find more information in the files D:\usr\sap\SOL\SUM\sdt\log\SUM\DEPLOY-COMPONENTS_22.LOG and ProcessOverview.html.
    To troubleshoot the problem use the provided information. An SAP Note may provide a solution to this problem. Search for SAP Notes with the following keywords:
    SUM??execute??component-deploy-700??deploy-components??com.sap.sdt.j2ee.services.servicesimpl.SDMService??class com.sap.sdt.j2ee.tools.sdmmanagement.OperateSdmException
    i try to restart server and killed sapstartsrv..  but the problem is not solved. 
    please let me know what i check more?
    D:\usr\sap\SOL\SUM\sdt\log\SUM\DEPLOY-COMPONENTS_22.LOG
    <!--LOGHEADER[START]/-->
    <!--HELP[Manual modification of the header may cause parsing problem!]/-->
    <!--LOGGINGVERSION[2.0.7.1006]/-->
    <!--NAME[D:\usr\sap\SOL\SUM\sdt\log\SUM\DEPLOY-COMPONENTS_22.LOG]/-->
    <!--PATTERN[DEPLOY-COMPONENTS_22.LOG]/-->
    <!--FORMATTER[com.sap.tc.logging.TraceFormatter(%d [%6s]: %m)]/-->
    <!--ENCODING[UTF8]/-->
    <!--LOGHEADER[END]/-->
    Apr 19, 2015 3:59:00 AM [Info  ]: Stopping SDM server...
    Apr 19, 2015 3:59:00 AM [Info  ]: AS Java process ID 11 has been started.
    Apr 19, 2015 3:59:00 AM [Info  ]:   Command line: D:\usr\sap\SOL\DVEBMGS00\exe\sapjvm_4\bin\java.exe -Xmx900M -Djava.ext.dir=d:/usr/sap/SOL/DVEBMGS00/SDM/program/lib;D:/usr/sap/SOL/DVEBMGS00/exe/sapjvm_4/jre/lib/ext -cp . -jar d:\usr\sap\SOL\DVEBMGS00\SDM\program\bin\SDM.jar shutdown Sdmguiport=50018 sdmHome=d:/usr/sap/SOL/DVEBMGS00/SDM/program logfile=D:\usr\sap\SOL\SUM\sdt\log\SUM\OperateSDM_60.LOG
    Apr 19, 2015 3:59:00 AM [Info  ]:   Standard out: D:\usr\sap\SOL\SUM\sdt\log\SUM\OPERATESDM_44.OUT
    Apr 19, 2015 3:59:00 AM [Info  ]: Process ID 11 has been started.
    Apr 19, 2015 3:59:00 AM [Info  ]: Waiting for process ID 11, name java.exe to finish.
    Apr 19, 2015 3:59:02 AM [Info  ]: Process ID 11, name java.exe has been finished, exit code 16.
    Apr 19, 2015 3:59:02 AM [Info  ]: Process ID 11, name java.exe has been terminated.
    Apr 19, 2015 3:59:02 AM [Error ]: The following problem has occurred during step execution: com.sap.sdt.j2ee.tools.sdmmanagement.OperateSdmException: Could not stop SDM server.
    Cannot execute Java process for stopSDM with parameters 50018.
    Return code condition success evaluated to false for process java.exe for action ACTION_STOP.
    Best regards..

    Could not stop SDM server. Cannot execute Java process for stopSDM with parameters 50018. Return code condition success evaluated to false for process java.exe for action ACTION_STOP
    Please follow the solution mentioned in the below link.
    Error During Deployment - Java Support Package Manager (OBSOLETE) - SAP Library
    regards,
    pavan

  • 64 bit RHEL 4 - runInstaller: cannot execute binary file

    I have downloaded Forns and Reports services install of application server for itanium linux. When trying to run the installer, I get:
    /opt/oracle/depot/Disk1/runInstaller: line 135: /opt/oracle/depot/Disk1/install/runInstaller: cannot execute binary file
    Google brought back hits about 32-bit installer on 64-bit linux. This is 64-bit installer on 64-bit linux:
    file /sbin/init
    /sbin/init: ELF 64-bit LSB executable, AMD x86-64 ...
    file /opt/oracle/depot/Disk1/install/runInstaller
    /opt/oracle/depot/Disk1/install/runInstaller: ELF 64-bit LSB executable, IA-64, ...
    Any help is appreciated.

    linux32 bash

  • [SOLVED] cannot execute binary file / humble bundle

    I'm having trouble executing a number of games I've downloaded via Humble Bundle. One game, for example, I downloaded as "supermeatboy-linux-06072012-bin". Here are some of the outputs I get while attempting to execute:
    $ bash supermeatboy-linux-06072012-bin
    supermeatboy-linux-06072012-bin: supermeatboy-linux-06072012-bin: cannot execute binary file
    $ sh supermeatboy-linux-06072012-bin
    supermeatboy-linux-06072012-bin: supermeatboy-linux-06072012-bin: cannot execute binary file
    $ ./supermeatboy-linux-06072012-bin
    bash: ./supermeatboy-linux-06072012-bin: No such file or directory
    I'm getting the same scenario from a number of other games so I suspect the issue to be with either my environment or my approach.
    My architecture is x86_64
    I'd be more than happy to supply any additional environmental information
    Thanks archers
    Last edited by shoe (2013-11-11 15:05:40)

    Muflone wrote:
    More likely you're trying to use a 32 bit file without having the ia32 libraries.
    Please execute
    file supermeatboy-linux-06072012-bin
    and check if reports ELF 32-bit something. In such case please enable the multilib repository from /etc/pacman.conf and install the lib32 packages (surely the lib32-glibc and maybe others).
    Hint: a supermeatboy package exists in the AUR but I've never used it.
    $ file  supermeatboy-linux-06072012-bin
    supermeatboy-linux-06072012-bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), GNU/Linux 2.6.8, stripped
    multilib is enabled and I installed lib32-glibc-2.18-8 succesfully, however am getting the same issue. I see whole a lot of different lib32 packages available, are there maybe some more I should try?
    Worth noting that I do have all of the depencies installed that AUR suggests supermeatboy uses
    I suppose I could install via pacman, but this wouldn't solve the issue for the few other games with the same errors. I'm mostly just looking to learn how to make it work
    Thanks for reply!

  • /usr/bin/ld: CANNOT EXECUTE binary file!

    So whenever I try to compile something, I get to the step
    checking for gcc... gcc
    checking for C compiler default output file name...
    configure: error: C compiler cannot create executables
    See `config.log' for more details.
    And looking at the log, my problem is...
    /usr/bin/ld: /usr/bin/ld: cannot execute binary file
    Which... Is bad. Yes, I've tried chmodding it +x. I've also tried logging in as root and trying to run it, no luck.
    What's wrong? =/
    Would asking someone else with an iMac G5 to send me theirs, fix it?

    Running configure on all open source packages brings me to the ld cannot execute error in configure.log. In this case I was attempting to build libssh2 (SSH functions for PHP).
    Thanks for the link Nils, I'll try that.

  • Cannot compile Java files or create Java Project

    Hi,
    I cannot compile java files and also didn't see any option
    for creating java project using flex 2 builder.
    Actually am trying to create a FDS project with an option to
    compile on the server. I am using Weblogic 8.1 SP5 as my server.
    thank you
    sun

    hi
    this is may jvm.config file. Can anyone tell me if it is
    right because all the fields are blank.
    # VM configuration
    # Where to find JVM, if {java.home}/jre exists then that JVM
    is used
    # if not then it must be the path to the JRE itself
    # If no java.home is specified a VM is located by looking in
    these places in this
    # order:
    # 1) JAVA_HOME environment variables (same rules as java.home
    above)
    # 2) bin directory for java.dll (windows) or
    lib/<ARCH>/libjava.so (unix)
    # 3) ../jre
    # 4) registry (windows only)
    java.home=C:\Adobe\Flex Builder 2.0 Beta 3\Flex SDK 2.0\jre
    # Arguments to VM
    java.args=-ea -Xmx384m
    # Environment variables we care about, whitespace-separated
    env=
    # java.class.path - use this for adding individual jars or
    # directories. When directories are included they will be
    searched
    # for jars and zips and they will be added to the classpath
    (in
    # addition to the directory itself), the jar to be used in
    launching
    # will be appended to this classpath
    java.class.path=C:\Adobe\Flex Builder 2.0 Beta 3\Flex SDK
    2.0\jre
    # where to find shared libraries, again use commas to
    separate entries
    java.library.path=
    thanks
    sun

  • How can i execute "*.java " files in Workshop

    Hi,
    Im sunil,new to this weblogic workshop8.1..i dont know how to execute standalone .java files or servlets in workshop.plz help me and tell the way.
    regards
    Budati sunil

    Im not too sure about the Java project. But single normal java files with public static void maain(String [] args) are very simple to execute.
    1. Write the java code somewhere lets call this class A.
    2. Make a dummy page flow.
    3. In the begin action of this pageFlow, call the main method of the A class directly using A.main(null) since main is a static method. your code will work fine.
    4. If you have to pass a String[] as parameters. Before calling main, create this String[] and then pass it.
    In this way you can make a jsp and take the input from the user also.
    Hope it helps
    Cheeers

  • How to get "Executable java file"?

    Hi,
    I wanted to get the .class file of my java programme for execution. i.e say "c:\java Abc ", I wanted to get "Abc" so that I can execute my file in my GUI like "java Abc".
    Here is what I am doing
    File file;
    String command = "java";
    Process p;
    String classname = file.getPath(),fileName = file.getName();
    p = Runtime.getRuntime().exec(command+" "+classname);
    When I use this, I get the .java file. I wanted to get the "EXECUTABLE FILE ONLY", can any one help me?
    Thanks

    Put these lines after fileName = file.getName();
    if (fileName.endsWith(".java"))
        // Remove the .java extension from the filename
        fileName = fileName.substring(0, fileName.length() - 5);
    }

  • Cannot execute java.exe

    I'm really having a hard time here. I have installed, uninstalled and installed again SDK1.3.1. I've updated my autoexec.bat to look as follows and I still get cannot execute c:\jdk13\bin\java.exe when trying to do the -version command. I'm running Windows ME. Any suggestions????
    SET PROMPT=$p$g
    SET TEMP=C:\WINDOWS\TEMP
    SET TMP=C:\WINDOWS\TEMP
    SET COMSPEC=C:\WINDOWS\COMMAND.COM
    SET windir=C:\WINDOWS
    SET winbootdir=C:\WINDOWS
    SET PATH=C:\jdk13;C:\jdk13\bin;C:\jdk13\jre;C:\jdk13\lib;C:\jdk13\include;C:\WINDOWS;C:\WINDOWS\COMMAND;C:\PROGRA~1\DELL\RESOLU~1\COMMON\BIN
    SET CLASSPATH=.;c:\jdk13\lib\tools.jar
    Thanks,
    Leeanne

    Didn't work :(:(:(:( I've even went to the bin directory and try to execute java -version from the directory and still get an error cannot execute c:\jdk13\bin\java.exe. I get the same error trying javac too. I really want to learn java, but not having much luck. Is there a problem with Windows ME and Java??
    Thanks!

  • Cannot compile java file after ..

    i installed java sdk 1.4
    uninstalled java 1.2 & java 1.3.1
    --after that i was not able to compile or run java file
    reinstalled java 1.3.1 and 1.2
    --now able to run previously compiled java file
    --cannot compile a new java file
    any help

    It would be helpful if you would exactly tell us what error message you get instead of just saying "I can't compile or run anything anymore".
    Things to think of: Did you add the bin directory of the JDK to your path? Is the classpath set correctly?
    Installation notes
    http://java.sun.com/j2se/1.4/install-windows.html
    Setting the class path
    http://java.sun.com/j2se/1.4/docs/tooldocs/win32/classpath.html
    Java 2 SDK Readme
    http://java.sun.com/j2se/1.4/README.html
    Jesper

  • JSP executing .java file

    Hi,
    I have a small and simple question about JSP: can it either:
    - compile a .java file and then execute (or interpret) the bytecode created ?
    - execute a .class file ?
    Thank you

    ok nevermind,
    found a good tutorial about this.
    cheers

  • I cannot open AirPortDevices Unix Executable file it says  cannot execute binary file

    i cannot open AirPortDevices Unix Executable file. when i try it says cannot execute binary file

    If you are wiling to share one of these files via Dropbox, I have a few old Macs floating around that I can use to figure out what files these are, if they are not corrupted during the copying process.
    Have you tried OpenOffice or LibreOffice?
    If you can see the dates on these files, you can also try looking at http://en.wikipedia.org/wiki/Comparison_of_word_processors to see what could have been used.
    Do you recall the source machine from where these came? You have mentioned Classic II and SE 30.

  • Cannot generate java file from i18ngen utility

    Hi,
    I have a message catalog file named PNS.xml which generated by MsgEditor and
    its content as follow.
    <message_catalog
    i18n_package="weblogic.i18n"
    l10n_package="weblogic.i18n"
    subsystem="pns"
    version="1.0"
    >
    <!-- -->
    <message
    messageid="lang_id"
    datehash="336038090"
    datelastchanged="1020896502008"
    method="langId(String arg0)"
    >
    <messagebody>
    EN {0}
    </messagebody>
    </message>
    </message_catalog>
    --------------- End of content
    However, there is no output file(s) in c:\temp\weblogic\i18n\ directory
    when I enter the follow command.
    C:\Temp>java weblogic.i18ngen -debug weblogic\msgcat\PNS.xml
    Options:
    server=false
    ignore=false
    verbose=false
    debug=true
    nobuild=false
    i18n=false
    l10n=false
    compile=false
    Processing input: C:\Temp\weblogic\msgcat\PNS.xml
    Using validating parser
    Document start
    Receive element: message_catalog
    Adding new message_catalog
    PNS.xml
    Setting attr: name=i18n_package, value=weblogic.i18n
    Setting attr: name=l10n_package, value=weblogic.i18n
    Setting attr: name=subsystem, value=pns
    Setting attr: name=version, value=1.0
    Receive element: message
    Adding new Message
    Setting attr: name=messageid, value=lang_id
    Setting attr: name=datehash, value=336038090
    Setting attr: name=datelastchanged, value=1020896502008
    Setting attr: name=method, value=langId(String arg0)
    processing method, langId(String arg0)
    Setting method name, langId
    Adding arg, String
    Receive element: messagebody
    Adding new messagebody
    Received chars: <
    EN {0}
    >
    adding to body
    linking messagebody to message lang_id
    linking message lang_id to message_catalog
    Validating simple message catalog...
    Validating message...
    C:\Temp>
    (C:\Temp is already in my classpath)
    If anyone knows how to use this utility, please let me know.
    Thanks for your help.
    Tommy

    Admittedly poor choice of option names. -i18n causes Logger classes to be
    created. Loggers are generated from Log message catalogs, which you aren't
    using. The -l10n option works on your catalog. The diff between i18n and l10n
    is the notion of whether the generated classes are used for i18n-izing or
    localizing at runtime. When you use the generated Logger classes you are
    outputting localizable (ie internationalized) message to the log. The
    TextFormatter, on the other hand, produces localized output
    Tommy wrote:
    Sorry for the typo, the command I used in the last message should be this
    one.
    C:\Temp>java weblogic.i18ngen -i18n -debug weblogic\msgcat\PNS.xml
    For another scenario, the java file and the properties file could be
    generated with the -l10n option.
    What is the different in between those options?
    Thanks for your help.
    Tommy
    "Tommy" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I have a message catalog file named PNS.xml which generated by MsgEditorand
    its content as follow.
    <message_catalog
    i18n_package="weblogic.i18n"
    l10n_package="weblogic.i18n"
    subsystem="pns"
    version="1.0"
    >
    <!-- -->
    <message
    messageid="lang_id"
    datehash="336038090"
    datelastchanged="1020896502008"
    method="langId(String arg0)"
    >
    <messagebody>
    EN {0}
    </messagebody>
    </message>
    </message_catalog>
    --------------- End of content
    However, there is no output file(s) in c:\temp\weblogic\i18n\ directory
    when I enter the follow command.
    C:\Temp>java weblogic.i18ngen -debug weblogic\msgcat\PNS.xml
    Options:
    server=false
    ignore=false
    verbose=false
    debug=true
    nobuild=false
    i18n=false
    l10n=false
    compile=false
    Processing input: C:\Temp\weblogic\msgcat\PNS.xml
    Using validating parser
    Document start
    Receive element: message_catalog
    Adding new message_catalog
    PNS.xml
    Setting attr: name=i18n_package, value=weblogic.i18n
    Setting attr: name=l10n_package, value=weblogic.i18n
    Setting attr: name=subsystem, value=pns
    Setting attr: name=version, value=1.0
    Receive element: message
    Adding new Message
    Setting attr: name=messageid, value=lang_id
    Setting attr: name=datehash, value=336038090
    Setting attr: name=datelastchanged, value=1020896502008
    Setting attr: name=method, value=langId(String arg0)
    processing method, langId(String arg0)
    Setting method name, langId
    Adding arg, String
    Receive element: messagebody
    Adding new messagebody
    Received chars: <
    EN {0}
    >
    adding to body
    linking messagebody to message lang_id
    linking message lang_id to message_catalog
    Validating simple message catalog...
    Validating message...
    C:\Temp>
    (C:\Temp is already in my classpath)
    If anyone knows how to use this utility, please let me know.
    Thanks for your help.
    Tommy

  • Cannot compile Java file

    I'm creating java file using package.javax.* but when i compile they say javax not found. I already try using jdk1.2.2 and jdk1.3.1. so any idea?

    There isn't any javax package. There are a lot of packages like javax.swing, javax.crypto, javax.naming.ldap, and so on. If you want to import a package you have to provide it's full name.

  • [solved]cannot execute binary files

    For example, what I'm trying to do:
    [summerset@arch tmp0]$ ls
    test.cpp
    [summerset@arch tmp0]$ cat ./test.cpp
    #include <fstream>
    int main() {
    printf("here am I");
    [summerset@arch tmp0]$ g++ ./test.cpp
    [summerset@arch tmp0]$ ./a.out
    bash: ./a.out: Permission denied
    [summerset@arch tmp0]$ chmod +x ./a.out
    [summerset@arch tmp0]$ ./a.out
    bash: ./a.out: Permission denied
    [summerset@arch tmp0]$ file ./a.out
    ./a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
    [summerset@arch tmp0]$ ldd ./a.out
    ldd: warning: you do not have execution permission for `./a.out'
    not a dynamic executable
    [summerset@arch tmp0]$ uname -a
    Linux arch 2.6.34-bfs #1 SMP PREEMPT Fri May 21 08:18:49 ALMT 2010 i686 AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 AuthenticAMD GNU/Linux
    [summerset@arch tmp0]$
    The same thing when I try to run it from root. Any suggestions?
    Last edited by veen (2010-05-23 23:44:17)

    unplugged23 wrote:Most desktop enviornments and window managers should allow you to right click on the file, hit properties, and check a little box titled something like 'is executable'
    A have already did that:
    chmod +x ./a.out
    Really, it's strange. Have anyone had similar problem?
    upd: the problem actually was in mount options for my home partition.
    Last edited by veen (2010-05-23 23:45:35)

Maybe you are looking for