| | |
compiling from command line
![]() |
Ok I still can't do this?
Let's say this is where my javac program is:
And this is where I have written my program
How do I compile hello.java so that the class files appear in the same directory?
I assume these commands have something to do with it. Please help me
:cry:
p.s is this version of java j2sdk1.4.2 an old version. Should I update. The reason I say that is because I can't get the code for Scanner util to work and the graphics g
Let's say this is where my javac program is:
Java Syntax (Toggle Plain Text)
c:\j2sdk1.4.2_04\bin
And this is where I have written my program
Java Syntax (Toggle Plain Text)
c:\java files\hello.java
How do I compile hello.java so that the class files appear in the same directory?
I assume these commands have something to do with it. Please help me
:cry:
Java Syntax (Toggle Plain Text)
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
p.s is this version of java j2sdk1.4.2 an old version. Should I update. The reason I say that is because I can't get the code for Scanner util to work and the graphics g
*Voted best profile in the world*
All you need to do is add the location of your javac program to the path variable of your computer. That way, you can execute javac from anywhere. Using this method, all you need to do is change to your project folder and execute "javac file.java". To add a location to your path variable, right-click My Computer, select Properties, select the Advanced tab, and select Environment Variables. There should be two path variables: one for your user and one for the system. If you use multiple users, add to the System path variable; otherwise, modify your User path variable. To add a location to the path variable, select path, click Edit, go to the end of the variable value, add a semi-colon (semi-colons seperate locations in the path variable), and add the location you want to add (c:\j2sdk1.4.2_04\bin in your case). After you click OK on all the dialog windows, close any remaining command windows, reopen them, and you now can access the programs in the "c:\j2sdk1.4.2_04\bin" folder from anywhere.
If you don't want to set the path variable, you can always compile by referring to the javac program by it's full name while in your project folder, such as:
If you don't want to set the path variable, you can always compile by referring to the javac program by it's full name while in your project folder, such as:
Java Syntax (Toggle Plain Text)
c:\j2sdk1.4.2_04\bin\javac hello.java
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
![]() |
Similar Threads
- C command-line I/O question (C++)
- Compiling and running an entire poject from command line/terminal on Linux (IT Professionals' Lounge)
- JCreator- command line prompt (Java)
- compile of header, .cpp and program on command line (C++)
- command line (OS X)
Other Threads in the Java Forum
- Previous Thread: New to Netbeans and Slightly to Java
- Next Thread: finding a class inside a jar file
| Thread Tools | Search this Thread |
6 @param actuate android api applet application arc array arrays automation balls binary bluetooth bold business byte c++ chat class client code codesnippet collections compare component coordinates database defaultmethod detection doctype dragging ebook eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework hql html ide ideas image ingres input integer internet intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans newbie nextline parameter php pong problem program programming project recursion recursive scanner sell server set sms sort sql string sun swing swt terminal threads tree web websites windows






