• 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

Setting CLasspath from command line

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to set a classpath through command line as follows--
java -classpath -Dcl.prop=C:\\server.properties
but the command line argument needs a "classname".....however I am doing this to be able to read the value of cl.props in the jsp using a System.getProperty("cl.prop");
How do I do this?When I do try
java -classpath -Dcl.prop=C:\\server.properties LL000SInput.jsp
--OR------
java -classpath -Dcl.prop=C:\\server.properties LL000S
I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: LL000SInput/jsp
---OR-------
Exception in thread "main" java.lang.NoClassDefFoundError: LL000S
Any help will be appreciated
Thanks,
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds you are trying to execute a jsp, this is not done by invoking java.exe. You need a servlet/jsp container in order to execute jsp's, such as tomcat ( http://jakarta.apache.org/tomcat/ ).
Now on to your question, this is assuming you have tomcat(or some servlet engine) set up correctly. I am assuming you are are specifing the value of cl.prop in the server.properties file. If this is the case, you only need server.properties on your classpath, and then you have access to all the properties in your code.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic