aspose file tools*
The moose likes Java in General and the fly likes Java -D does not work, why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java -D does not work, why?" Watch "Java -D does not work, why?" New topic
Author

Java -D does not work, why?

Dave Elwood
Ranch Hand

Joined: Dec 27, 2002
Posts: 84
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
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14348
    
  22

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java -D does not work, why?