Jump to content

Home

A question in JAVA.


Jem

Recommended Posts

Once I'm done with my Java Source File I cannot compile it under Command Prompt because I don't know how to specify the path javac has to use to look up classes.

 

Can someone tell me what is the command line I need to use to specify that path?

 

Thanks.

Link to comment
Share on other sites

You're not being specific on what platform you are on or anything, but if you just type "javac" you should get the usage deal. I just tried it on a Solaris machine and got this:

 

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
 -O                        Optimize; may hinder debugging or enlarge class file
 -nowarn                   Generate no warnings
 -verbose                  Output messages about what the compiler is doing
 -deprecation              Output source locations where deprecated APIs are us
ed
 -classpath <path>         Specify where to find user class files
 -sourcepath <path>        Specify where to find input source files
 -bootclasspath <path>     Override location of bootstrap class files
 -extdirs <dirs>           Override location of installed extensions
 -d <directory>            Specify where to place generated class files
 -encoding <encoding>      Specify character encoding used by source files
 -target <release>         Generate class files for specific VM version

 

Doesn't that pretty much tell you what you need to know (the classpath bit)?

Link to comment
Share on other sites

What I need is to use the javac command to compile my Java source code into Java bytecodes.

But each time I type "javac filename.java" under command prompt:

 

Ex:

 

C:\Work\javac filename.java

 

(My Java source code being in the file "Work")

 

It says:

'javac' is not recognized as an internal or external command, operable program or batch file

 

Now I've been told that it's because I need to specify the classes location. I've tried what you said and this:

http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

But there's something I'm doing wrong because it still doesn't work.

Link to comment
Share on other sites

I doubt it. Try just typing "javac" and see if you get anything (you should get about what I put in my previous post). If not, it has nothing to do with classes. It probably has to do with javac itself not being where your system can find it as a program. Try compliling in the directory where javac is located, and if it works, then you just need to set up some path crap to get it to work as you want.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...