This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Setting CLasspath from command line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Setting CLasspath from command line" Watch "Setting CLasspath from command line" New topic

Setting CLasspath from command line

Veni Velkoor
Ranch Hand

Joined: Oct 17, 2001
Posts: 65
I am trying to set a classpath through command line as follows--
java -classpath -Dcl.prop=C:\\
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:\\ LL000SInput.jsp
java -classpath -Dcl.prop=C:\\ LL000S
I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: LL000SInput/jsp
Exception in thread "main" java.lang.NoClassDefFoundError: LL000S
Any help will be appreciated
Chris Hall
Ranch Hand

Joined: Dec 04, 2002
Posts: 39
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 ( ).
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 file. If this is the case, you only need on your classpath, and then you have access to all the properties in your code.
I agree. Here's the link:
subject: Setting CLasspath from command line
Similar Threads
Can't run the Client program - of HFE -- HELP -- Urgent
error while runing the jar file.
same error when using XP and Eclipse to run program
Regarding Thread Dump command
basic problem compiling/running code