Forum Stats

  • 3,840,134 Users
  • 2,262,571 Discussions
  • 7,901,154 Comments

Discussions

Path Problem with Running java.exe Program

User_AYF65
User_AYF65 Member Posts: 135 Red Ribbon
edited Aug 26, 2015 3:16AM in New To Java

Hi,

I have got java in my Path variable. I am able to run 'javac.exe' but when i am running java, i am getting following error:

D:\>javac

Usage: javac <options> <source files>

where possible options include:

  -g                         Generate all debugging info

  -g:none                    Generate no debugging info

  -g:{lines,vars,source}     Generate only some debugging info

  -nowarn                    Generate no warnings

  -verbose                   Output messages about what the compiler is doing

  -deprecation               Output source locations where deprecated APIs are u

sed

  -classpath <path>          Specify where to find user class files and annotati

on processors

  -cp <path>                 Specify where to find user class files and annotati

on processors

  -sourcepath <path>         Specify where to find input source files

  -bootclasspath <path>      Override location of bootstrap class files

  -extdirs <dirs>            Override location of installed extensions

  -endorseddirs <dirs>       Override location of endorsed standards path

  -proc:{none,only}          Control whether annotation processing and/or compil

ation is done.

  -processor <class1>[,<class2>,<class3>...]Names of the annotation processors t

o run; bypasses default discovery process

  -processorpath <path>      Specify where to find annotation processors

  -d <directory>             Specify where to place generated class files

  -s <directory>             Specify where to place generated source files

  -implicit:{none,class}     Specify whether or not to generate class files for

implicitly referenced files

  -encoding <encoding>       Specify character encoding used by source files

  -source <release>          Provide source compatibility with specified release

  -target <release>          Generate class files for specific VM version

  -version                   Version information

  -help                      Print a synopsis of standard options

  -Akey[=value]              Options to pass to annotation processors

  -X                         Print a synopsis of nonstandard options

  -J<flag>                   Pass <flag> directly to the runtime system

D:\>java

Error: could not open `C:\Program Files\Java\jre6\lib\i386\jvm.cfg'

D:\>


My path variable contents are:


C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\Program Files\ActiveState Komodo Edit 5\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;d:\Program Files\MiKTeX 2.9\miktex\bin\;C:\Program Files\MATLAB\R2012b\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\MicrosoftASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program

Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;D:\Program Files\Java\jdk1.6.0_21\bin


Some body please guide me.


Zulfi.

Answers

  • TPD-Opitz
    TPD-Opitz Member Posts: 2,465 Silver Trophy
    edited Aug 21, 2015 3:17AM

    You should also set JAVA_HOME to D:\Program Files\Java\jdk1.6.0_21


    bye

    TPD

  • User_AYF65
    User_AYF65 Member Posts: 135 Red Ribbon
    edited Aug 26, 2015 3:16AM

    Hi,

    Thanks for your help. I actually i tried JAVA_HOME but it did not work. Then the administrator put the java files from d:\Program Files\... to C:\Program Files\ and change the path to both system and Administrator path variable to :

    C:\Program Files\Java\jdk1.6.0_21\bin


    It then worked.


    Thanks.


    Zulfi.

This discussion has been closed.