• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Parsing of script files in java

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,
The intermediate forum seems the best place to put this, as I'm sure someone can just point me to a URL where all this has been done.
Consider, a shell script (.bat/.cmd or unix style) that contains

or, on windows

How can I parse the file in java and resolve $CLASSPATH so that all the referenced variables are expanded.
At the moment, I've been able to get the "java -classpath" line out of the file, because lchan.main is the only real fixed reference point that I have...
Thanks in advance
L
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you just trying to get the classpath of the machine, so that you know what it SHOULD resolve to?
You can use
String gotClassPath = System.getProperty(java.class.path);
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Are you just trying to get the classpath of the machine, so that you know what it SHOULD resolve to?


Ultimately yes... However, this a class that is part of a separate jvm that has a different classpath from the one that would have been started by the script.
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic