• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java -D does not work, why?  RSS feed

 
Dave Elwood
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few days ago when trying to get a glassfish database to run It told me to run :

java -Dij.something.something=somesuch

before starting ij.bat

okay, that worked.

Now I wish to set the system property derby.system.home, so in a batch file I write

java -Dderby.system.home=C:\derby

and java spills out the help screen contents

-- Sorry, that command needs to be followed by a class to execute
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15865
81
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The -D option sets a Java system property, but only for the JVM instance that you're running at that time. It does not save the value somewhere. A line like this is incomplete:

java -Dderby.system.home=C:\derby

It's missing the name of the class that you want to run. It should be something like:

java -Dderby.system.home=C:\derby org.mypackage.MyClass

I'm sure that the line you had to enter for Glassfish also had something else after it, otherwise you'd have gotten the same help information from Java.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!