• 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

Java command options

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Up until now I have relied on my Java Editor (JCreator Pro) to handle my java compiling. I am now trying to learn how to do it all from the command line so that I will be able to work on any platform.
I know the basic command options for compiling and running a java program. However, the classpath option is confusing me a little.
I know that java -classpath path_to_extra.jar myFile.java will compile my java file using path_to_extra.jar to search for external class libraries that I have included that are not part of the standard JDK.
Now, when I launch this application, and I use the -classpath with the java command, does it work the same? Do I even need to include it? Or does using this tag used with the JAVA command over-ride the compilers default package search?
Thanks for any help.
 
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gregg
I, too, have had difficulties navigating the nuances of classpath and sourcepath. This doesn't specifically answer your question, but it might be helpful.
I avoid the classpath issue entirely by dumping any extra jar files I need into the following folder: [JDK home]\JRE\lib\ext. By placing your jar files in that folder the compiler will recognize those files without you having to change your classpath setting.
I'm sure that I will eventually discover that there is a drawback to this technique, but it has helped me get around the classpath issue. If anyone thinks that this solution is terrible, please let me know.
[ April 09, 2002: Message edited by: Dave Winn ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic