0

I am attempting to get java set up on my PC and I am having issues. I believe these issues are related to configuring the path correctly.

Currently if I run java in my cmd line, I get the following:

Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -client to select the "client" VM -server to select the "server" VM 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>
              Warning: this feature is deprecated and will be removed
              in a future release.
              require the specified version to run
-showversion  print product version and continue
-jre-restrict-search | -no-jre-restrict-search
              Warning: this feature is deprecated and will be removed
              in a future release.
              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 with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions with specified granularity
-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

See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

However, when I try and run javac, I get the following:

bash: javac: command not found

I attempted to set up the path by following a video on youtube, but it does not seem to have helped.

Any advice would be greatly appreciated.

Thank you in advance.

3
  • 3
    Did you install the JDK or just the JRE? Commented Feb 13, 2016 at 3:42
  • You don't need the git bash to run Java Commented Feb 13, 2016 at 3:42
  • You need the JDK for javac. Other than that, the output of java looks fine. You need to specify the name of a class (e.g. java --classpath=/path/to/.class/files MyClass) or a JAR (e.g. java -jar /path/to/app.jar`). Commented Feb 13, 2016 at 3:48

2 Answers 2

3

install JDK first in your system.

after do the following

1). My computer -> right click -> Properties

2). Advance System Setting on left side

3). Click on Environment Variable

4). Click new in user Variable For System_name

5). Variable Name:- PATH

Value:- **YOUR JDK PATH UPTO BIN FOLDER** , AT END ";"

Example:- C:\Program Files\Java\jdk1.8.0_45\bin;

Then type JAVA and JAVAC in cmd

Sign up to request clarification or add additional context in comments.

2 Comments

Good answer. @kderrick one piece of advice: make sure not to screw up the rest of your PATH. Don't remove/reset the PATH. Simply add a new value to the already existing one because otherwise other programs utilizing the PATH wont be able to.
thankyou @AshwinGupta i mentioned that click on new variable
0

Are you trying to simply install java on your system to run programs or do you want to write and execute code? If you want to just install it for programs, the java website has all the downloads for installing java to run on your system. For writing code, I recommend DrJava, a develpment environment that is both relatively easy to use and has many features that allow for powerful coding abilities, once you learn them and need them. I hope this helps if I understood what you are trying to do.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.