Two Laptop Bag
The moose likes Beginning Java and the fly likes VM Options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "VM Options" Watch "VM Options" New topic

VM Options

Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
Could someone please specify what I need to do in order to include system properties in my Java Program. I believe the program is expecting to read some values from a properties file. I want to include these values to the VM when it starts. My understanding it to do the following....
java -D onewire.adapter.default={DS9097E} onewire.port.default=COM1 javaClassName
when I do that I get a NoClassDefFoundException. That error tells me that my classpath is incorrect. When I run without the -D option it runs fine, but can not find the system properties that I need to provide. So why is it when I specify properties on the command line, it's expecting something else in the classpath. "Oh classpath....Why do you hate me ?"
Thanks in advance for you help,

Java: The power, elegance, and simplicity of a hand grenade
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
You can't have any embedded spaces in the property flag. Try:

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
moving to JiG(intermediate) since this is not a beginner's question.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I agree. Here's the link:
subject: VM Options
It's not a secret anymore!