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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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: 83
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
Bartender

Joined: Aug 16, 2005
Posts: 12926
    
    3

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 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java -D does not work, why?
 
Similar Threads
Why javac requires .java extension and java command does not?
to run C program in Java
run sh file
Wrapper Classes
Create a windows executable from a jar