path

Getting the folder name from a path

前提是你 提交于 2019-12-27 11:01:51
问题 string path = "C:/folder1/folder2/file.txt"; What objects or methods could I use that would give me a result of folder2 ? 回答1: I would probably use something like: string path = "C:/folder1/folder2/file.txt"; string lastFolderName = Path.GetFileName( Path.GetDirectoryName( path ) ); The inner call to GetDirectoryName will return the full path, while the outer call to GetFileName() will return the last path component - which will be the folder name. This approach works whether or not the path

How to update PATH variable permanently from Windows command line?

被刻印的时光 ゝ 提交于 2019-12-27 10:42:07
问题 If I execute set PATH=%PATH%;C:\\Something\\bin from the command line ( cmd.exe ) and then execute echo %PATH% I see this string added to the PATH. If I close and open the command line, that new string is not in PATH. How can I update PATH permanently from the command line for all processes in the future, not just for the current process? I don't want to do this by going to System Properties → Advanced → Environment variables and update PATH there. This command must be executed from a Java

Cant choose a default path in java when using ImageIcon in Java

南笙酒味 提交于 2019-12-25 18:18:08
问题 Whenever i need to load some image i have difficulties with its path Like i use eclipse and by putting it in src folder and then using this path ImageIcon = new ImageIcon ("/image.png"); It does not load image i need to put it somewhere in my computer and then copy paste its path ....Its not Actually better option as when i tend to run my code in some other computer i need to change the paths of all images in my code back again please help Thanks 回答1: Create "resource" folder into your

Importing java classes text editor

不羁的心 提交于 2019-12-25 16:35:52
问题 Recently I started using a text editor (text mate) instead of eclipse to program in Java. I hava file1.java in a folder A(/Users/kevincastro/Documents/Code/estructuras/clases) and a file2.java in folder B(/Users/kevincastro/Documents/Code/estructuras/datastructures). I want to import file2.java to file1.java but it doesn't word. I've tried : import Users.kevincastro.Documents.Code.estructuras.datastructures.*; import datastructures.*; import Documents.Code.estructuras.datastructures.*; none

Importing java classes text editor

故事扮演 提交于 2019-12-25 16:34:06
问题 Recently I started using a text editor (text mate) instead of eclipse to program in Java. I hava file1.java in a folder A(/Users/kevincastro/Documents/Code/estructuras/clases) and a file2.java in folder B(/Users/kevincastro/Documents/Code/estructuras/datastructures). I want to import file2.java to file1.java but it doesn't word. I've tried : import Users.kevincastro.Documents.Code.estructuras.datastructures.*; import datastructures.*; import Documents.Code.estructuras.datastructures.*; none

Saving image - path problem

一笑奈何 提交于 2019-12-25 14:11:18
问题 public void SaveJpeg(string path, Image image, int quality) { //ensure the quality is within the correct range if ((quality < 0) || (quality > 100)) { //create the error message string error = string.Format("Jpeg image quality must be between 0 and 100, with 100 being the highest quality. A value of {0} was specified.", quality); //throw a helpful exception throw new ArgumentOutOfRangeException(error); } //create an encoder parameter for the image quality EncoderParameter qualityParam = new

Saving image - path problem

萝らか妹 提交于 2019-12-25 14:08:40
问题 public void SaveJpeg(string path, Image image, int quality) { //ensure the quality is within the correct range if ((quality < 0) || (quality > 100)) { //create the error message string error = string.Format("Jpeg image quality must be between 0 and 100, with 100 being the highest quality. A value of {0} was specified.", quality); //throw a helpful exception throw new ArgumentOutOfRangeException(error); } //create an encoder parameter for the image quality EncoderParameter qualityParam = new

Physical Path for image saving. Asp.net

送分小仙女□ 提交于 2019-12-25 11:57:19
问题 I have a web project and I saved my images in Physical folders in hdd Like d:\SecretImages\Imagename . But I can't open the files when I have to? I thought if it can saves for examle d:\SecretImages\Temp.jpg , I can open when I have to but, I can't. Help me please, thanks 回答1: You cannot use file paths to show your images. The browser doesn't know where to find the images and the server wouldn't serve them up anyway due to security concerns. You could/should use an HttpHandler to show the