Originally to do the purpose of data mining in which network, the structure has become a system development ...
But still more serious to do for three months, the teacher is very agree with my work attitude and results ...
The internship is coming to an end, summarizing a few things that have not been noticed before to become habits and problems, to share to everyone.
At the same time to play an advertisement: to which network Internal audit department recruit Javaweb Development intern, Time is very free, a week, Saturday Sunday even can, the time of the small partners to give me a message ah, earn a pocket money, but also a long experience .... (GPA, want to work a senior dog is the most suitable ... )
In Web projects, it is often necessary to upload files, or generate files to the project root directory; many user.dir on the internet are not good to use, here is the code.
The advantage of this code is that both Windows and Linux are applicable. This solves the inconsistency that was developed under Windows and deployed under Linux. hahaha, very good code:
public class Getserverrealpathutil {//Get Project REAL path in server//under Windows and Linux system normal use public static String Getrootpath () { String ClassPath = GetServerRealPathUtil.class.getClassLoader (). GetResource ("/"). GetPath (); String RootPath = "", if ("\ \". Equals (File.separator)) {//windows under RootPath = classpath.substring (1, Classpath.indexof (" /web-inf/classes ")); RootPath = Rootpath.replace ("/"," \ \ ");} if ("/". Equals (File.separator)) {//linux under RootPath = classpath.substring (0,classpath.indexof ("/web-inf/classes")); RootPath = rootpath.replace ("\ \", "/");} return rootpath;}}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Where to go net internship summary: How to get the Web project root directory (Javaweb)