• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compile From Console

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How to compile a .java file that uses multiple .jars in it.
Like i hav a servlet ,it uses some other jars compared to servlet-api.jar..
what will be the syntax for this...do i need to use the classpath ,because its alredy there in Environment Settings.


Thankx
amarshi
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What environment settings? You mean the CLASSPATH environment variable? If it specifies all the JARs you need, it should work.
Anyway, you can always override it by using the -classpath argument to the javac command.
 
amarshi mohanty
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have the below files :
1.D:\Console\FileDownlaod.java
2.D:\Console\XmlGenerator.java
3.D:\Console\servlet-api.jar
4.D:\Console\log4j-1.2.8.jar

Now I m using the below command

javac -classpath D:\Console\servlet-api.jar;D:\Console\log4j-1.2.8.jar D:\Console\D:\Console\FileDownlaod.java

to create FileDownload.class inside D:\Console\
So now i have
D:\Console\FileDownlaod.class

The XmlGenerator.Java uses FileDownload.java,so i had to compile FileDownload first.

Now whicg command to write inorder to create XmlGenerator.class , uisng FileDownload.class in the syntax.
I even tried to convert FileDownload.class to FileDownload.jar , but still its not working?
Can anyone tell me the correct syntax for this ?

Thanks
Amarshi
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't set a system CLASSPATH. try adding ;. to the end of the CLASSPATH you are setting with the -classpath option.
Why are you not working inside the directory your .java file is in?
It is not possible to answer without knowing what use your two classes make of each other. Which contains the main method? Did you suffer any error messages when compiling? What happens when you go into the Console folder and write this?
javac FileGenerator.java
 
reply
    Bookmark Topic Watch Topic
  • New Topic