hgbdelphi
asked on
how can i get mySystem name in javaBean?
hi,experts
public class XSqlAction{
String userdir=System.getProperti es().getPr operty("us er.dir"); //
//after run userdir="E:\resin-3.0.12"
}
my system in
E:\resin-3.0.12\webapps\tr ack
how can i get it in XSqlAction?????
public class XSqlAction{
String userdir=System.getProperti
//after run userdir="E:\resin-3.0.12"
}
my system in
E:\resin-3.0.12\webapps\tr
how can i get it in XSqlAction?????
ASKER
hi,objects
i not want to use Servlet Context,can i define my systemname in system var(like $mysystem="track") or define in classpath,and how can i get it ??/
thanks!
i not want to use Servlet Context,can i define my systemname in system var(like $mysystem="track") or define in classpath,and how can i get it ??/
thanks!
Yes, you could set a system property using System.setProperty()
ASKER
in windows's system property ,i set jbasConfigSystem="track"
how can i get it
System.out.println("mydefi ne:"+Syste m.getPrope rties().ge tProperty( "jbasConfi gSystem"))
it is mydefine:null
how can i get it.
how can i get it
System.out.println("mydefi
it is mydefine:null
how can i get it.
> in windows's system property
not in windows properties, you need to set it in java system properties
not in windows properties, you need to set it in java system properties
ASKER
but if i set it in java system properties,i need to write code to do it ,i want not to do it ,and i define in window property,and in class,i read it and use it.but i do not know how can i read it in my class,please help,thanks!
you can specify system properties on the command line
java -DjbasConfigSystem=E:/resi n-3.0.12/w ebapps/tra ck ......
java -DjbasConfigSystem=E:/resi
ASKER
but this is j2ee project,i can not do it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ha,thanks,in loadServlet,i set System.setProperty("myname ","track")
and when i use i get System.getProperty("myname ")
thanks!
Best Regard for objects !!!
and when i use i get System.getProperty("myname
thanks!
Best Regard for objects !!!
ASKER
hi,objects
sorry,now i have 2 content,if i use System.setProperty("myname ","track") ,and System.getProperty("myname "),it will overwrite the first set myname,and how can i do it???
Thanks!
sorry,now i have 2 content,if i use System.setProperty("myname
Thanks!
context.getRealPath("/");