Running java command from DOS prompt

Hi,
When I run java from the DOS prompt (NT) in any other location than the JDK bin directory, I get the following error:
Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
My understanding is to be able to run this from anywhere you need to add the tools.jar file to the CLASSPATH, which I have done.
There is no entry in the Registry for Software\JavaSoft...etc, has anyone any idea what my problem is and how I can solve it?
Thanks in advance

Hi,
I am running Java 2 SDK, Standard Edition Version 1.2.2 running on NT. It was installed as part of Oracles JDeveloper IDE and is running on NT.
All I want to be able to do is run java from the command line e.g. 'java myclass', to run a standalone Java program. I can run 'javac myclass.java' to compile the program without any problems, but my understanding is that to do this all I need is to have the '.../java1.2/bin' directory included in the 'PATH' variable, whereas to run the java runtime you need to include the tools.jar in the CLASSPATH variable.
As I said previously I can run the 'java myclass' command from the '../java1.2/bin' directory, just not from anywhere else. As for whats in the code, does not matter you should be able to type just java on the command line and it will come back with an error prompting for the class name. Here is an example of what happens:
I:\>java
Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
However if I change to the correct directory, I get:
D:\oracle\JDev32\java1.2\bin>java
Usage: java [-options] class [args...]
(to execute a class)
or java -jar [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-? -help print this help message
-X print help on non-standard options
The contents of my PATH and CLASSPATH variable are shown below, Thanks again.
I:\>PATH
PATH=D:\oracle\BIN;D:\oracle\Apache\Perl\5.00503\bin\mswin32-x86;C:\Program Files\Oracle\jre\1.1.7\b
in;D:\oracle\ora8i\bin;C:\DMINT40\Win32\Bin;C:\WINNT\system32;C:\WINNT;C:\Program Files\Symantec\pcA
nywhere;d:\oracle\jdev32\java1.2\bin;d:\downloads\oraxml\bin;d:\oracle\jdev32\java1.2\lib\tools.jar
I:\>echo %CLASSPATH%
d:\oracle\jdev32\java1.2\lib\tools.jar;d:\oracle\apache\apache\htdocs\web-inf\classes;d:\oracle\apac
he\jserv\servlets

Similar Messages

  • Win2000 NoClassDefFoundError running java.exe from DOS prompt

    I am using Windows 2000 with J2SE v 1.3.1_02 and have a problem when I run java.exe from the command line for classes that are defined to be in a package. I can both compile and run this program from the TextPad editor but when I run it from a DOS prompt I get the error "Exception in thread "main" java.lang.NoClassDefFoundError: MyClass"
    My CLASSPATH is set to D:\
    The files MyClass.java and MyClass.class are in the directory D:\MyProject
    here is the source:
    package MyProject;
    public class MyClass
         public static void main(String[] args)
              System.out.println("MyClass main");
    Note that if I comment out the package statement and add "." to CLASSPATH then it runs from the DOS prompt. Why does the program run from inside TextPad but not from the DOS prompt? Seems to be some type of bug in java.exe on Windows 2000 when the keyword package is used.

    It turns out that if you use the main method in a class that declares the package statement you need to use the fully qualified name to run the program. Using this statement works for this problem:
    java MyProject/MyClass
    the forward slash is required even though is a Windows system.

  • Running java program from DOS

    I have just installed JDK 5.0 (update 4) and have tried writing a small demo program. The .class module is created ok but when invoking java I get "Exception in thread "main" java.lang.NoClassDefFoundError. I am running java from a DOS batch file with one command of c:\progra~1\java\jdk15~1.0_0\java %1. A similar batch file is used to invoke javac which works.
    Any ideas what I'm doing wrong? Thanks.

    You can't run a Java program from DOS, in fact you can't even install a JRE under that old operating system as Java requires a 32 bit or 64 bit operating system architecture which DOS never offered.
    But on the off chance you mean a command prompt from Windows...
    Check your classpath, most likely you forgot to add the current directory to that.

  • Unable to run JAVAC command at DOS prompt

    I installed JDK1.3.1 I gave the pathas
    C:\JDK1.3.1 and changed the Autoexec.bat file to have
    Set Path=C:\JDK1.3.1\Bin;
    When I am trying to run command javac it gives me this message
    This program cannot be run in DOS mode
    I cant start, Please help
    Thanks
    Ehsan

    Did you reboot the system after the install -- what you put in the autoexec.bat doesn't become effective until the system has been rebooted.
    If you don't want to reboot, you can try this:
    C:\JDK1.3.1\Bin\javac -classpath C:\JDK1.3.1 HelloWorld.java
    V.V.

  • Converting multiple bmp files to PDF using acrobat 7.0 from DOS prompt

    Hi,
    I have a requirement to convert multiple BMP files in a folder to one PDF.
    I can use multiple file conversion option in acrobat to combine and convert them to one PDF .. but I have 2000 such folder to conver to PDF.
    PDF should be name after the folder name.
    Is there a to automate this in acrobat.. or can we run this conversion from DOS prompt using commands.. so that I can create a bat file and have them converted. Pls let me know.
    Thanks
    Pugazh

    I have not tried BMP files, but do JPeg, GIF, TIFF, and PNG files regularly. I simply open Acrobat, then select the graphics files in explorer and drag & drop to Acrobat. I then organize the graphics if needed (using the pages tab) and save to a PDF.

  • Running ssh command from java and then answering password prompt

    Hi,
    I have a situation that has not solved yet. I am running ssh command from unix terminal without any problem, and then i enter password.
    For example :
    [oracle@fuata]:/export/home/oracle> ssh -N [email protected] -L 9901:127.0.0.1:9999
    Password:
    It is working. I have question that how can i perform this in java? I am thinking that i can run ssh command by using Runtime Class, it is ok. But how can i answer the password? I am a bit confused. Is there any example looks like this?
    Thanks for responses.

    futi wrote:
    Thanx. Firstly i insisted to do this without jsch but actually this is harder than jsch. I edit some of code pieces PortForwardingL.java and could run it. It works problem-free. Could you say why you "insisted" on this approach. It can't be for speed+ since jsch is very fast. It can't be for portability+ since jsch is portable but the use of Runtime.exec() requires the installation of ssh software. It can't be because of limitations+ since jsch is a fully featured library. It can't be for security+ since jsch is secure. It can't be for ease of use+ since jsch is much easier to use than ssh with Runtime.exec(). Unless it's a licensing issue, it can't be for commercial+ reasons since jsch is free. The only reason I can think of why one would "insisted" on this approach is if it is for some college project.

  • Running ls command from Java stroed procedure no output

    Hi ,
    I am trying to run ls command from java stored procedure in oracle
    Process p = Runtime.getRuntime().exec("ls");
    BufferedReader stdInput = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("output of the command run:\n");
    while ((s = stdInput.readLine()) != null) {
    System.out.println(s);
    from java stored procedure in oracle.
    i get output of println statments but it does not go into while loop to print from stdInput.
    Result of running Java stored procedure is -
    output of the command run:
    Call completed.
    when i run the program on client side it works fine.
    Has anybody tried this from java stroed procedure.
    Thanks,
    Jag

    Jag,
    Actually, the question of whether it works for me seems to depend on the version of the OS (or Oracle). On RedHat Linux (Oracle 8.1.6) it didn't work at all, but on Solaris (Oracle 9.0.2) it did. Here's the output from that run:
    SQL> /
    output of the command run:
    init.ora
    initDBPart9i.DBPSun01.ora
    initdw.ora
    lkDBPART9I
    orapw
    orapwDBPart9i
    spfileDBPart9i.ora
    Done
    PL/SQL procedure successfully completed.
    But, I did need to change a line of your code to this:
    Process p = Runtime.getRuntime().exec("/usr/bin/ls");
    your original was:
    Process p = Runtime.getRuntime().exec("ls");
    You might consider, if possible, use of some of the Java File classes instead of ls, as this might make things more predictable for you. There were some examples in oramag.com a few months ago, but they were pretty simple (you might not need them).
    Hope this helps,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

  • Need command to run sql script from sql prompt

    Hi,
    I am beginner in sql i need a command to run sql file from sql prompt.In notepad i have write 10 to 15 tables creation and saved as .sql i want to run this file from sql promp pls some one help.I am very great full to all users in this forum.

    You can also use the 'start' command.
    You may also want to look in the SQLPlus User Guide and Reference (for your release) at the set command for commands to set the number of lines per page, turn headings on or off, and so on:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/toc.htm
    HTH -- Mark D Powell --

  • Running Unix Command from WEB-APPLICATION

    Hi all,
    I want to run unix command from a java-based web application. the basic code part is this ---
    public class RunCommand
          public String runIt()
              String s = null, returnString = "";
              Process p=null;
              try
                       Runtime rt = Runtime.getRuntime();
                  p = rt.exec("sh testPOC.ksh");
                  p.waitFor();
                  BufferedReader stdInput = new BufferedReader(new
                       InputStreamReader(p.getInputStream()));
                  BufferedReader stdError = new BufferedReader(new
                       InputStreamReader(p.getErrorStream()));
                  // read the output from the command
                  returnString += "Here is the standard output of the command:<br>";
                  while ((s = stdInput.readLine()) != null) {
                      returnString += s;
                  // read any errors from the attempted command
                  returnString += "Here is the standard error of the command (if any): <br>";
                  while ((s = stdError.readLine()) != null) {
                      returnString += s;
              catch (IOException e)
                  returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              catch(Exception e)
                returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              return returnString;
      }this class is kept as an inner class. The control comes to its outer class, from servlet, from which the runit() is called. but the exception is occuring at line of p=rt.exec(.....). it tells "<command name> : not found transaction completed" [got this using getMessage() method].
    i am unable to show(and see, too) the stacktrace, because i don't have access to that test environment and its log. i can't run this in local because its windows one.
    now can anyone tell me, where is the problem. is there any limitation in web application server/container? this was successful when i used command prompt writing a .java file. Please help me. Thanks in advance...

    Friends, i've got, where the problem is.
    when we run a class file directly from a command prompt, we get an environment with that shell window. but for a servlet application running these kind of commands from a class creates kind of child processes. each and every command is executed as a child process of jvm and don't get those environment. we have 'PATH' variable in the environment. when a command (say, 'dir' or 'sh' or 'ls', etc.) is executed, the shell first search for that executable file (i.e. dir / sh / ls) in the given paths in the variable 'PATH'. this is not available for the child commands of jvm. hence the basic commands are searched in the current directory of the jvm and they are failed.
    i solved the problem giving full path of the commands. like :
    p = rt.exec("/bin/sh runningScript.ksh")

  • Run OS command from Oracle

    Hi All!!
    Which package can help me to run OS command from SQL script?
    Thanks.

    If you are using SQL*Plus to execute the script, you can use the SQL*Plus command HOST. If you are trying to execute an operating system command from a PL/SQL block (i.e. a stored procedure), you would need to use an external procedure or a Java stored procedure that uses Java's shell functionality.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Running sqlldr command from PL/SQL Block

    DECLARE
    BEGIN
    END;

    In SQL * plus we can run DOS commands using the following command
    HOST DIR
    HOST DIR/P
    But When we can't run the HOST command in PL/SQL Block..
    I have to Run sqlldr command from PL/SQL Block..
    i tried as follows
    DECLARE
    BEGIN
    EXECUTE IMMEDIATE ' host sqlldr control= bad= ';
    END;
    By
    BalaNagaRaju

  • 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

  • Is it possible to run host command from SAP environment? How do you run?

    Hi
    Is it possible to run host command from SAP environment? How do you run?
    Thank You

    Hello Subhash
    You will more details in the following thread:
    Re: How to define command for SXPG_COMMAND_EXECUTE
    Regards
      Uwe

  • Unable to run Java Command (on UNIX)

    Hi,
    When I try to run Java command:
    java ChatServer 9830
    I get the following error:
    /usr/bin/java: line 67: /tmp/javaJb9694: Permission denied
    /usr/bin/java: line 67: /tmp/javaJb9694: Success
    Could any one suggest what could be the reason and solution.
    The site is hosted on a UNIX palatform and we are using Tomcat.
    Thanks & Regards,
    Joy.

    lol
    How would we know? We don't know your setup, we don't know your software, we don't know what happens...
    It doesn't even look like a standard Java message to me.

  • How to run OS commands from PL/SQL???

    Hi
    Is there any way to run OS commands(Windows Platform) from within PL/SQL?
    Thanks

    APC,
    I am working on Discoverer, having lots of BAs & Workbooks created & stored in Database. Now if i want to move all the workbooks from one place to another (like from development to test or production) i can use Command line interface of Disco to do this. But i don't see any option there to export all the workbooks, so i thought of writing a pl/sql to get all the workbook names from the EUL then fire export Command for each record(although not a good practice but its a one time work). This is the place where i need to run OS command from within PL/SQL. Although it doesn't seem possible now(as you all said) without external procedure.
    Lastly, you are right that "Oracle make databases not operating systems" but my first impression/comment about oracle is:
    "Oracle is far Bigger, Powerful, Complex, Vast and Interesting System than any other..." so i believe it can do/capable doing anything :-)
    thx Ashutosh,
    Host is definitely an option but i can't run it from pl/sql(that i am looking for)..

Maybe you are looking for

  • Text2d... looking for answers

    I've been writing quite a few posts about text2d and text3d here, but they are rarely responded to... Im making a game with java3d, where I want to have a menu appear before the game starts. The menu is also j3d and its the one containing text2D. To

  • Excise entries for Performa Invoice

    Hi Experts, My client wants to have EXCISE entries to get posted automatically to the G/L Accounts maintained in VKOA whenever Performa Invoice is created. i.e. only for Excise condition types JEXP,JCEP,JA1X maintained in Pricing Procedure. Please su

  • [Forum FAQ] Introduce Windows Powershell Remoting

    This article will introduce three methods of Windows Powershell Remoting: Method 1: WMI Remoting Cmdlet: Get-WMIObject Protocols: WMI/RPC/DCOM Port: Random port Data Encryption: Clear text Note: No need of the WinRM's installation and configuration M

  • 404 not found: The requested URL /apex/f was not found on this server.

    That is the error I get in the browser. It occurs only on one page, all other work normally. The apache error log contains this: [Thu Aug 10 09:14:33 2006] [error] [client 0.0.0.0] [ecid: 1155226473:127.0.0.1:22240:0:50,0] mod_plsql: /apex/f HTTP-404

  • Report Application failing

    I'm running Forms and Reports 11g R2 under Weblogic 10.0.3.6. On the front page of the Middleware Control, all Forms and Reports components are shown as healthy (green). However, if I drill down to the reports application, it is shown as red. I can s