Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Devaka Cooray
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Jeanne Boyarsky
Tim Cooke
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Mikalai Zaikin
Carey Brown
Bartenders:
Forum:
Beginning Java
compileing with .jar file
Eung maeng
Ranch Hand
Posts: 68
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Does anyone explain to me how to compile or whether it is possible instead of import com.vertex....etc;
thanks,
Christophe Verré
Sheriff
Posts: 14691
16
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You'll always need the "import" whether you use JAR files or not.
[My Blog]
All roads lead to JavaRanch
Eung maeng
Ranch Hand
Posts: 68
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thanks, do i need to extract .jar for compiling the source if .jar contains a classes.
thanks a lot,
Christophe Verré
Sheriff
Posts: 14691
16
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No, just inlude the JAR in your classpath.
For example
javac -cp c:/myjars/bob.jar;. Hello.java
[My Blog]
All roads lead to JavaRanch
Eung maeng
Ranch Hand
Posts: 68
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thanks,
I tried to compile a source on dos prompt with your command like javac -cp.... -CP option is not valid for compiler.
anotherone,
e.g,
a test.java source is in c:\APP\PGM\
and
import B.UTIL.Iaddress;
import B.UTIL.Ilookup;
....
jar is in c:\lib\utility.jar what contains for Iaddress and Ilookup etc..
In this case, where I need to compile and how , what I have to do for compile.
Please let me know if it's not good exampe for your answer.
Regards,
Roseanne Zhang
Ranch Hand
Posts: 1953
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
use -cp for
java
command is fine
However, you must spell it out -classpath for javac command
Who knows why? But we have to follow it.
here is the official help from the commands
C:\Documents and Settings\rzhang>java 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 C:\Documents and Settings\rzhang>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 -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 used -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
Eung maeng
Ranch Hand
Posts: 68
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thanks, -cp =-classpath
Eung maeng
Ranch Hand
Posts: 68
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi,
How do I define multiple .jar for compile?
thanks a lot,
Roseanne Zhang
Ranch Hand
Posts: 1953
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
semicolon ; separated path for Windows
Use colon : for unix
Christophe Verré
Sheriff
Posts: 14691
16
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Pau, sorry for the wrong compiler argument.
[My Blog]
All roads lead to JavaRanch
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Running code
is khalid wrong?
Doubt in annotations.
can we create a class named Object?
Iimplicit cast
More...