How to get the path of OS(whether it is linux or Windows or Mac OS)
hi..
i want to know the path of the operating system currently running(whatever it is windows or Linux or Mac).Is it possible to know.... please respond me if anyone knows
Bharath.N.Kumar wrote:
why im dying to write a file on OS drive is, my application is portable and he can carry that app in a Compact-Disc(CD), can run on any machine(OS).If he runs that application from CD,the file generated cant be written on CD,so that i need to create this file on a Common folder(folder which must exists and independent of OS) in that system.Since the "directory where the OS resides" is
a.) a pretty pointless question in Unix and
b.) definitely not writable by most users on all major operating systems
I strongly suggest you choose another directory. "user.home" has already been mentioned. It is a System property that tells you where the current users home directory is. That's almost universally available and almost always writable, so that's definitely the better choice.
Similar Messages
-
How to get the path of local folder in native services in windows phone 8.1 ?
I used to get the path of local folder path in managed code by following -Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;But now I need to get the local folder path in native services .Please help me out ?
What do you mean by "native services"? Windows.ApplicationData.Lo alFolder is the way to access the local folder.
-
How to get the Path of the WebDynpro page
Hi All,
Can any one say how to get the path of the JSPDynPage ina Portlet in Portal Application.
Becoz i have to display that Page in another JSPDynPagee
Thanks in Advance....Hi,
You can call your JSPDynPage component by calling the URL as:
http://localhost:50000/irj/servlet/prt/portal/prtroot/YourApplicationName.YourComponentName
Check this:
Calling portal component
Greetings,
Praveen Gudapati
[Points are welcome for helpful answers] -
How to get the path when i select a directory or a file in a JTree
How to get the path when i select a directory or a file in a JTree
import java.lang.*;
import java.io.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.HeadlessException;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Iterator;
* @author Frederic FOURGEOT
* @version 1.0
public class JTreeFolder extends JPanel {
protected DefaultMutableTreeNode racine;
JTree tree;
protected JScrollPane scrollpane;
final static int MAX_LEVEL = 1; // niveau max de descente "direct" dans l'arborescence
* Sous-classe FSNode
* @author Frederic FOURGEOT
* @version 1.0
private class FSNode extends DefaultMutableTreeNode {
File file; // contient le fichier li� au noeud
* Constructeur non visible
private FSNode() {
super();
* Constructeur par initialisation
* @param userObject Object
FSNode(Object userObject) {
super(userObject);
* Constructeur par initialisation
* @param userObject Object
* @param newFile File
FSNode(Object userObject, File newFile) {
super(userObject);
file = newFile;
* Definit le fichier lie au noeud
* @param newFile File
public void setFile(File newFile) {
file = newFile;
* Renvoi le fichier lie au noeud
* @return File
public File getFile() {
return file;
public JTree getJTree(){
return tree ;
* Constructeur
* @throws HeadlessException
public JTreeFolder() throws HeadlessException {
File[] drive;
tree = new JTree();
// cr�ation du noeud sup�rieur
racine = new DefaultMutableTreeNode("Poste de travail");
// cr�ation d'un noeud pour chaque lecteur
drive = File.listRoots();
for (int i = 0 ; i < drive.length ; i++) {
FSNode node = new FSNode(drive, drive[i]);
addFolder(drive[i], node); // on descend dans l'arborescence du lecteur jusqu'� MAX_LEVEL
racine.add(node);
// Gestion d'evenement sur JTree (on �coute les evenements TreeExpansion)
tree.addTreeExpansionListener(new TreeExpansionListener() {
public void treeExpanded(TreeExpansionEvent e) {
// lorsqu'un noeud est ouvert
// on descend dans l'arborescence du noeud jusqu'� MAX_LEVEL
TreePath path = e.getPath();
FSNode node = (FSNode)path.getLastPathComponent();
addFolder(node);
((DefaultTreeModel)tree.getModel()).reload(node); // on recharche uniquement le noeud
public void treeCollapsed(TreeExpansionEvent e) {
// lorsqu'un noeud est referm�
//RIEN
// alimentation du JTree
DefaultTreeModel model = new DefaultTreeModel(racine);
tree.setModel(model);
setLayout(null);
// ajout du JTree au formulaire
tree.setBounds(0, 0, 240, 290);
scrollpane = new JScrollPane(tree);
add(scrollpane);
scrollpane.setBounds(0, 0, 240, 290);
* Recuperation des sous-elements d'un repertoire
* @param driveOrDir
* @param node
public void addFolder(File driveOrDir, DefaultMutableTreeNode node) {
setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
addFolder(driveOrDir, node, 0);
setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
* Recuperation des sous-elements d'un repertoire
* (avec niveau pour r�cursivit� et arr�t sur MAX_LEVEL)
* @param driveOrDir File
* @param node DefaultMutableTreeNode
* @param level int
private void addFolder(File driveOrDir, DefaultMutableTreeNode node, int level) {
File[] fileList;
fileList = driveOrDir.listFiles();
if (fileList != null) {
sortFiles(fileList); // on tri les elements
// on ne cherche pas plus loin que le niveau maximal d�finit
if (level > MAX_LEVEL - 1) {return;}
// pour chaque �l�ment
try {
for (int i = 0; i < fileList.length; i++) {
// en fonction du type d'�l�ment
if (fileList[i].isDirectory()) {
// si c'est un r�pertoire on cr�� un nouveau noeud
FSNode dir = new FSNode(fileList[i].getName(), fileList[i]);
node.add(dir);
// on recherche les �l�ments (r�cursivit�)
addFolder(fileList[i], dir, ++level);
if (fileList[i].isFile()) {
// si c'est un fichier on ajoute l'�l�ment au noeud
node.add(new FSNode(fileList[i].getName(), fileList[i]));
catch (NullPointerException e) {
// rien
* Recuperation des sous-elements d'un noeud
* @param node
public void addFolder(FSNode node) {
setCursor(new Cursor(3)); // WAIT_CURSOR est DEPRECATED
for (int i = 0 ; i < node.getChildCount() ; i++) {
addFolder(((FSNode)node.getChildAt(i)).getFile(), (FSNode)node.getChildAt(i));
setCursor(new Cursor(0)); // DEFAULT_CURSOR est DEPRECATED
* Tri une liste de fichier
* @param listFile
public void sortFiles(File[] listFile) {
triRapide(listFile, 0, listFile.length - 1);
* QuickSort : Partition
* @param listFile
* @param deb
* @param fin
* @return
private int partition(File[] listFile, int deb, int fin) {
int compt = deb;
File pivot = listFile[deb];
int i = deb - 1;
int j = fin + 1;
while (true) {
do {
j--;
} while (listFile[j].getName().compareToIgnoreCase(pivot.getName()) > 0);
do {
i++;
} while (listFile[i].getName().compareToIgnoreCase(pivot.getName()) < 0);
if (i < j) {
echanger(listFile, i, j);
} else {
return j;
* Tri rapide : quick sort
* @param listFile
* @param deb
* @param fin
private void triRapide(File[] listFile, int deb, int fin) {
if (deb < fin) {
int positionPivot = partition(listFile, deb, fin);
triRapide(listFile, deb, positionPivot);
triRapide(listFile, positionPivot + 1, fin);
* QuickSort : echanger
* @param listFile
* @param posa
* @param posb
private void echanger(File[] listFile, int posa, int posb) {
File tmpFile = listFile[posa];
listFile[posa] = listFile[posb];
listFile[posb] = tmpFile; -
How to get the path of the image stored in sap??
Hi All
The problem is
While making an entry in standard there is a field called documents through which we attach our images in sap.
How to get the path of the image stored with the corresponding order so that the image can be displayed while we are creating a report.
I know how to upload the image while creating a report using docking control.
I am not able to get the path of the image stored...
Please Help
Thanks in advance..
PoojaI am not aware of exactly which tables are used for storing the attached doc. details, but we have worked in the similar requiremnent.
What you can do is .... before uploading the image to any order, try swich on the SQL trace ST05 and after upload switch off.
The log will display what are the tables involved while storing the image. And you can easily find out the image location. -
how 2 get the path of a file Using jsp
i have tried getPath...but i'm geting the error
The method getPath(String) is undefined for the type HttpServletRequest
any idea how 2 get the path of a fileYou need ServletContext#getRealPath().
API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String) -
How 2 get the path of a file Using jsp
how 2 get the path of a file Using jsp
i have tried getPath...but i'm geting the error
The method getPath(String) is undefined for the type HttpServletRequest
any idea how 2 get the path of a fileYou need ServletContext#getRealPath().
API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String) -
How to get the Path of the Current File using Import & Export File -Reg.
Dear all,
I have a mega (big) doubt. I have manually inserted the Figures from the figure folders. Now i need, fully automated. So How can I get the Figure path
Example :
PMString path = "E://development/Figures/";
now i checked, How many subFolders is there in "path", get the All Subfolders and check to the Article Name.
Example
Article Name == subFolder name then get the Files from the SubFolders(E://development/Figures/ChapterF/*.eps files").
now I paste the Document using to For Loop.
Please any one can suggest me, How can We get the Path in SDK.
Note:
Should I have to create the relative path by myself?
No method supplied in SDK to do this directly?
Please I need a help of this Query as soon as posible.
Thanks & Regards
T.R.Harihara SudhaNhttp://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_file.asp?frame=true
When a file is uploaded, the file name is also submitted. The path of the file is available only to the machine within the Local Machine security zone. The value property returns only the file name to machines outside the Local Machine security zone. See About URL Security Zones for more information on security zones.
i need to know on how to get the compelete path /directory of the filename
using <input type="file"> tag You can't. Its a security thing.
is there any other way to get an input file from a local host aside from <input type="file"> tag?No. Not using just html.
You could always go into activex components, but thats different again.
Cheers,
evnafets -
How to get the path of the selected Jtree node for deletion purpose
I had one Jtree which show the file structure of the system now i want to get the functionality like when i right click on the node , it should be delete and the file also deleted from my system, for that how can i get the path of that component
i had used
TreePath path = tree.getPathForLocation(loc.x, loc.y);
but it gives the array of objects as (from sop)=> [My Computer, C:\, C:\ANT_HOME, C:\ANT_HOME\lib, C:\ANT_HOME\lib\ant-1.7.0.pom.md5]
i want its last path element how can i get it ?Call getLastSelectedPathComponent() on the tree.
-
How to get the path of the folder?
hello everybody,
I want to retrive the path of folder. how can i do? i used File I/O > Adv file fun > File dialog and set the file dialog property to "Folder". but I cannot get the path included with folder name. Can somebody help me? thanks in advance..Did you select "File or Folder" for the file dialog?
and
Did you click on the Current Folder button when selecting the folder?
R
Message Edited by JoeLabView on 09-03-2008 07:56 AM
Attachments:
fileFolder.PNG 11 KB
currentFolder.PNG 6 KB -
How to get the path of input type="file" tag
-- im using <input type="file"> tag to get an input file from a local host, it returns only the filename but not the complete path of the filename,,,
-- i need to know on how to get the compelete path /directory of the filename using <input type="file"> tag , or is there any other way to get an input file from a local host aside from <input type="file"> tag?
thankshttp://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_file.asp?frame=true
When a file is uploaded, the file name is also submitted. The path of the file is available only to the machine within the Local Machine security zone. The value property returns only the file name to machines outside the Local Machine security zone. See About URL Security Zones for more information on security zones.
i need to know on how to get the compelete path /directory of the filename
using <input type="file"> tag You can't. Its a security thing.
is there any other way to get an input file from a local host aside from <input type="file"> tag?No. Not using just html.
You could always go into activex components, but thats different again.
Cheers,
evnafets -
How to get the path of the image stored in DMS
Hi everyone..
My question is that I have attached an image with an order through transaction jha2n..
Now my requirement is to get the image in report..
I know the Logical id in ISM_l_ord class and physical id in ISM_P_Ord class.
I know that link between image and order is in SKWG_BREL.
But i am not able to get the path so that i can show the image in docking control.
pls help to retrive the path of the image stored...
Thanks
PoojaEpicMaster wrote:Now the problem is when I run the application through the .jar file in the dist/ directory the images simply wont load...
..lblProduct.setIcon(new ImageIcon("Resources.zip/res/Product.png"));
Now the problem is when I Build&Clean the whole project which creates a /dist directory containing the complied and execulatble .Jar file for the application AND a folder called "lib" which contains the Resource.Zip folderThe String based constructor to ImageIcon presumes the String represents a File path. File objects do not work with resources inside Jar or Zip archives, for those, you need an URL. Gain the URL using something like..
URL urlToImage = this.getClass().getResource("/res/Product.png"); -
How to get the path of my webapp?
example mywebapp: " http://xxxx.com/test/index.html"
The "test" is the path of my webapp,is there any function use to get the path in the HttpServlet?
thanks!request.getContextPath();
-
How to get the path of placed plugin location
hi all,
I want to get the path of my placed plugin location in my custom plug-in code.
supporse my custom plugin at :
C:\Program Files\Adobe\Adobe Illustrator CS5.1\Plug-ins\MyCustomPlugin\MyCustomPlugin.aip
Is any API is there that can tell me my plugin path or the Directory path.
Regards
Ashish.hi Patterson,
I actully i am looking for XMLDocument api.
Is any API adobe providing so I can use this to API for itterate this xml document.
Let me clear you more...
see this is my xml document
<PropertyGridConfiguration>
<Control name="ControlType" type="ComboBox">
<Option>None</Option>
<Option>List</Option>
<Option>Menu</Option>
<Option>Label</Option>
<Option>TextBox</Option>
</Control>
<Control name="ControlStyle" type="ComboBox">
<Option>None</Option>
<Option>ListStyle</Option>
<Option>ItemStyle</Option>
</Control>
</PropertyGridConfiguration>
I want to read this in memory is AI is provides us any API. -
How to get the path of the cache directory ?
Hi everyone,
I need to get the path of the cache directory to copy files into it (these files are security files that are necessary to encrypt data).
Maybe there is a jnlp.jar to have object that implements a method getCachePath() ? But I can't find it.
Any ideas ?. thanks.you can find the cache location by finding the location of the jar file you are running from:
URL resource =
this.getClass().getClassLoader().getResource("testResource");
if (resource != null) {
String s = resource.toString();
if (s.startsWith("jar:")) {
int index = s.indexOf("!");
if (index > 4) {
String fileurl = s.substring(4,index);
if (fileurl.startswith("file:")) {
String path = fileurl.substring(5);
// now path is the path to the jar file in the cache containing the resource
/Dietz
Maybe you are looking for
-
How to connect my new Nokia 1110i with my windows ...
i have recently purchased nokia 1110i. to download sceeensavers, and ringtones i was told that i could connect my phone with usb cable CA 42. i bought that cable but dont know how to connect the phone and the pc. please help. thanks in advance
-
Report for inventory , COGS at plant / GL account level
Hi, We have a need to develop a BI report for pulling out the following information : 1) Inventory at plant level 2) COGS value for a plant 3) The above detail would be needed at account level. Any table/SAP report from where we can pull these data.
-
Hi All, I am working on a SSIS task in which i need to get data from Oracle database which is on remote server. But when created the SSIS package and tried to create the connection from the connection manager using OLE DB connection, I am not able to
-
Accesing an RFC from webdynpro throws exception
I am trying to call an RFC from Webdynpro which in turn calls another RFC in another system..... Example: I am calling an RFC function thats exists in XYZ system from webdynpro. This RfC function is calling another RFC function that exists in ABC sy
-
I am unable to wear my persona selection, even after retarting firefox
I am unable to install any personas, even after restarting firefox. When I click "wear this persona" nothing happens.