• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java -D does not work, why?

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic