Summarize some ways to take Java paths Online:
Note: If you start the program from Ant, This.getclass () getresource ("") to take out the strange, directly with the Java command Line debugging can be successful.
Some methods to get classpath and the absolute path of the current class
To obtain a path beyond Classpath
Java Gets the current time
1 New java.util.Date (); 2 New Timestamp (Date.gettime ());
Java gets yesterday's time
1 Calendar cal = calendar.getinstance (); 2 Cal.add (calendar.date,-1); 3 New SimpleDateFormat ("Yyyy-mm-dd"). Format (Cal.gettime ());Where Calendar provides operations for various time units, such as Cal.add (calendar.year,-2), yo
ImportJava.text.SimpleDateFormat;Importjava.util.Date;ImportJava.util.Calendar; Public classmainprocess { Public Static voidMain (string[] args) { //func1 Calendar Cld=calendar.getinstance (); intYY =Cld.get (calendar.year); intMM = Cld.get (calendar.month) +1; intDD =Cld.get (calendar.date); intHH =Cld.get (Calendar.hour_of_day); intMM =Cld.get (Calendar.minute); intSS =Cld.get (Calendar.second); intMI =Cld.get (Calendar.millisecond); //from an integral type, so the format does not add 0, such
Original website: http://blog.csdn.net/shendl/article/details/1427475(Note: Use the following method to get the path, if there is a space character in the path, then there will be "%20" to replace, so you can then replace "%20 " with a space)Here are some ways to get the absolute path of classpath and the current class. You may need to use some of these methods t
Multiple ways to get the current file path in Java Public String Getclasspath () { String path=""; try {Path=new File (GetClass (). getClassLoader (). GetResource (""). Touri ()). GetPath (); }catch (URISyntaxException ex) {} return path; } Directory path when the program is run. The path where the program double-clicks or the bat file is locatedSystem.ge
);//release pointer using free Free(Char_result);returnString_result;//If you use Java 16 binary conversion, it should also be possible, write with C 16 binary conversion too troublesome //jclass class_handledata = (*env)->findclass (env, "Com/hengbao/util/handledata"); //tem_method = (*env)->getstaticmethodid (env, Class_handledata, "BytesToHexString1", "([B) ljava/lang/string;"); //jobject Obj_result = (*env)->callstaticobjectmethod (e
) method 1. Do you have any restrictions?2) method 2 gets the call stack through the exception mechanism, with the worst performance, but can provide functions not available for other methods, as well as the method name and row number; however, this is not a common practice;3) method 3 is just a brief analysis of the name of the anonymous class. Obviously, it is much simpler. In fact, the performance is also the highest;
----------------------------------
--------------------------------------
At some point we need to get the Tomcat process number and then handle some other transactions through the process number. So in the Web project, how do you get the PID of the current Tomcat server in some ways. First, we know that we can use the Exec () method to execute Linux commands. Then we can have such a thought:
Pass through an interface--Execute
1. Get the current timeRuby Code
Calendar cal = Calendar.getinstance ();
String Time=formatter.format (Cal.gettime ());
String strend=time.substring (0, 16);//2007-10-30 09:30
2. Get the day beforeRuby Code
Calendar C = calendar.getinstance ();
C.add (Calendar.day_of_month,-1);
SimpleDateFormat formatter = new SimpleDateForm
1. The Init method in the servlet can be usedString Path=getservletcontext.getpath ("/");Here is the full path to get the Web project.Example: E:\eclipseM9\workspace\tree\Tree is the root directory of my Web project2. Can be called in any classThis.class.getClass (). Getclassloder (). Getresourse (). GetPath ("/");The path to all classes is obtained here.Example: e:\eclipsem9/workspace/tree/web-inf/classes/3, Request.getcontextpath ();Gets the Web roo
public class Test { public staticvoid main(String[] args) { Properties props = System.getProperties(); props.list(System.out); }}Java.version Java: Runtime Environment versionJava.vendor Java: Runtime Environment VendorURL of the Java.vendor.url:Java vendorJava.home:Java installation directoryJava.vm.specification.version:Java Virtual Machine Specification versionJava.vm.specification.vendor:Java Virtual Ma
Blog
Community
Homepage
New essay
Contact
Management
Subscription
Post-42-0 comments-72 differences between java. util. Date and java. SQL. Date and the application of java. util. Date are used in addition to SQL statements.
; $ Break; the } the the //output The remaining date, starting from the second week, so it's 8-week. the for(intI=8-week; i){ - inSystem.out.print (i+ "\ T"); the the //A line is changed every seven days, and the date can be divisible by 7. About if((I+week)%7==0){ the System.out.println (); the } the
file that saved the time zone configuration, the result is nothing. But there's always a JRE going to the system to get the time zone configuration. So I started thinking, is Java using a system configuration file in Linux? So go to the Linux system under the/etc/sysconfig directory to see the time zone configuration. Found missing clock This file for setting the time zone. Copy this file from another Linu
Transferred from: http://blog.sina.com.cn/s/blog_6d416c1e01019zod.htmlTake yesterday's date, the cut-off date of this thought is good. Another thought wrong, if today is a number what to do?Two options available1: The Old method Date as = new Date (new Date (). GetTime () -
Detailed description of mysql to obtain the current date and format, detailed description of mysql current date
MySQL obtains the current date and Date Format
Java Get date and time method summaryIn writing a Java program is always unavoidable with the date and time, especially in the project, in accordance with a variety of requirements to display different formats of the date and time
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.