New virtual Directory using JAVA

Hello Friends;
I want to create a folder under SAP j2ee engine and i want to upload my files under new folder and use it like
http://portal:port/Newfolder/mynew_photo.jpg
It is possible in iis. For ex.  i can create a folder manuel under
c:\inetpub\wwwroot\new_folder
and after i put my files i can use it
http://iisserver:port/new_folder/new_photo.jpg
I have tried this directories
D:\usr\sap\p50\JC01\j2ee\cluster\server0\apps\sap.com
D:\usr\sap\p50\JC01\j2ee\cluster\server0\apps\
D:\usr\sap\p50\JC01\j2ee\cluster\server0\
and i have create new folder but i couldnt use it.
I hope that i have explained my question.
Thanks in Advance
Best Regards

Dear Eray,
              You can use the following Java code to create the Folder (Directory) in the SAP J2EE Engine and add the contents in the Directory
import java.io.*;
class CreateDirectory
   public static void main(String args[])
      try{
    String strDirectoy ="test";
    String strManyDirectories="dir1/dir2/dir3";
    // Create one directory
    boolean success = (new File(strDirectoy)).mkdir();
    if (success) {
      System.out.println("Directory: " + strDirectoy + " created");
    // Create multiple directories
    success = (new File(strManyDirectories)).mkdirs();
    if (success) {
      System.out.println("Directories: " + strManyDirectories + " created");
    }catch (Exception e){//Catch exception if any
      System.err.println("Error: " + e.getMessage());
Rewards Points if useful..
Regards,
N.Jayanth Kumar

Similar Messages

  • Having trouble with creation of a cloud service with multiple virtual machines using java sdk.

    I am creating a cloud service on azure with 2 virtual machines using java sdk API. Service created successfully.
    My input endpoint details are as follows.
    INPUT ENDPOINTS
    Head : 191.238.144.47:2400
    Head : 191.238.144.47:22
    Node0 : 191.238.144.47:43211
    For Head instance port 2400 is for HTTPS and port 22 is for SSH and for Node0 instance port 43211 is for SSH.
    But I am having problem with doing a ssh on Head instance. Sometimes it works sometimes doesn't. Same problem with HTTPS also.
    I have some application running over there but when i try to access it thru browser sometimes it works but most of the time doesn't. When I restart the instances from azure portal, its works after
    that(not always but most of the time). 
    Now I am confused what is going on there. I am creating cloud service and virtual machines using java sdk and setting input endpoints also. After creation of all instances i restart every instance programmatically .
    I am not sure whether restart is required or not. It must be something to do with input endpoints only but not able to get the right thing i guess. When i do the same thing thru azure portal(creation of cloud service with virtual machines and setting up input
    end points) everything works fine but not achieving the result when implementing it by java sdk API. Please help me.

    HI Nithin,
    Thanks for your reply. I am setting the endpoints after creating my instances using update call. Here's the code snippet.
    AzureService aServ = new AzureService(session);
     if(aServ.checkNameAvailability(clusterName)) {
               aServ.createHostedService(clusterName, "dbX cluster");         
             // Creating head instance
             aServ.createHead(clusterName, imgName, headType, userName, pswd);  
            // Setting end points for head node
             String name = "ssh";
             int port = 22;
             aServ.updateVMInputEndpoint(clusterName, "Head", name, port);
             // Restarting head instance
             aServ.restartVM(clusterName, "Head");
           String roleName = "Node";
           String tmpRoleName = "";
           for(int i=0; i<noi; i++) {
                      port = 43210+(i+1);
                      tmpRoleName = roleName + i;
                   // Creating node instance
                    aServ.createVM(clusterName, tmpRoleName, imgName, nodeType, userName, pswd);
                  // Setting end points for node instance
                   aServ.updateVMInputEndpoint(clusterName, tmpRoleName, name, port);
                  // Restarting node instance
                 aServ.restartVM(clusterName, tmpRoleName);
          // Method to update the input endpoint details 
          public void updateVMInputEndpoint(String clusterName, String vmName, String name, int port)
            throws Exception {
                    VirtualMachineGetResponse resp = computeManagementClient.getVirtualMachinesOperations().
                                                            get(clusterName, clusterName, vmName);
                    VirtualMachineUpdateParameters updateParameters = new VirtualMachineUpdateParameters();
                    //get the configuration list
                    ArrayList<ConfigurationSet> configlist = resp.getConfigurationSets();
                    //get inputendpoint list and update it
                    ArrayList<InputEndpoint> endpointlist = configlist.get(0).getInputEndpoints();
                    InputEndpoint inputEndpoint = new InputEndpoint();
                    inputEndpoint.setEnableDirectServerReturn(false);
                    inputEndpoint.setPort(port);
                    inputEndpoint.setLocalPort(port);
                    inputEndpoint.setName(name);
                    inputEndpoint.setProtocol(InputEndpointTransportProtocol.TCP);
                    endpointlist.add(inputEndpoint);
                    // Open port for https on head node
                    if(vmName.equals("Head")) {
                            inputEndpoint = new InputEndpoint();
                            inputEndpoint.setEnableDirectServerReturn(false);
                            inputEndpoint.setPort(2400);
                            inputEndpoint.setLocalPort(2400);
                            inputEndpoint.setName("https");
                            inputEndpoint.setProtocol(InputEndpointTransportProtocol.TCP);
                            endpointlist.add(inputEndpoint);
                    updateParameters.setConfigurationSets(configlist);
                    //required for update
                    OSVirtualHardDisk osVirtualHardDisk = resp.getOSVirtualHardDisk();
                    updateParameters.setOSVirtualHardDisk(osVirtualHardDisk);
                    updateParameters.setRoleName(resp.getRoleName());
                    OperationResponse updtResp = computeManagementClient.getVirtualMachinesOperations().update(clusterName, clusterName, resp.getRoleName(), updateParameters);
    And every time i am creating a new cloud service along with head and node instances. Region is "South Central US".
    I am setting ProvisionGuestAgent field to true at instance creation time. Thank you.

  • Creating aVirtual directory Using java

    Hai ,
    I am Using windows XP Operating system, I know how to create a directory using java,
    can you please suggest me a procedure to create a virtual(web share ) directory using java.
    waiting for your reply
    Thanks & Regards,
    Naga Raju

    Virtual Programmer is in the to share the directory
    over the Internet.No, that's a file/web server. :) I see, it's a Microsoft term.

  • Exchange 2013 - Unable to recreate ECP Virtual Directory using New-EcpVirtualDirectory

    Hello,
    I had a problem accessing ECP so I decided to recreate its virtual directory on the client access server. I used Remove-EcpVirtualDirectory. The cmd completed successfully. Then I tried running New-EcpVirtualDirectory and am getting the following error:
    Argument: -Role ClientAccess
        + CategoryInfo          : InvalidArgument: (:) [New-EcpVirtualDirectory], ArgumentException
        + FullyQualifiedErrorId : 3C22AE5F,Microsoft.Exchange.Management.SystemConfigurationTasks.NewEcpVirtualDirectory
    Running the command using the -role clientaccess parameter doesn't change the outcome. I have tried running the Exchange setup using the recoverserver switch but the installator is unable to detect any problems with the installation and refuses to continue
    with the recover. Any thoughts?

    Hi,
    Unfortunately, this didn't help either, but it has resulted in a different error message which has eventually led me to an answer, so thank you very much for your help!
    The problem turned out to be quite strange (or not, I'm not very proficient with Exchange). It turned out that all the commands that I was executing, were actually applied to the mailbox server not to the CAS (hance the -role clientaccess error - it couldn't
    have been installed on a server that didn't have the role). Once, I used the -server parameter you proposed, the command failed again. The problem now was that while it was finally pointing to the right server it was still using the installation path on the
    mailbox server (SIC!). Exchange on the mailbox server has been installed at a non-default location and somehow the New-EcpVirtualDirectory command ran on CAS was trying to get to that path. So the trick that finally worked and something that Microsoft again
    doesn't include in their site was using the parameter -path as part of the command:
    new-ecpvirtualdirectory -internalurl https://xx.xx.xx/ecp -role clientaccess -server servername -websitename "Default Web Site" -Path "C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\ecp"
    Hope it helps some poor soul some day. Thank you all for your help.

  • Saving the password of a user in active directory using java

    Hello, i am trying to use java to build a class that creates a user in Active directory 2012.But the problem is that when the user is created the password is not being saved.
    Can anybody help on this knowing that i tried to save in the fields userPassword and unicodePwd.
    Thanks.

    DirContext ctx = new InitialDirContext(pr);
              BasicAttributes entry = new BasicAttributes(true);
              String entryDN = "cn=CharbelHad,ou=test users,dc=test,dc=dev";
              Attribute cn = new BasicAttribute("cn", "ChHad");
              Attribute street = (new BasicAttribute("streetAddress", "Ach"));
              Attribute loginPreW2k = (new BasicAttribute("sAMAccountName", "[email protected]"));
              Attribute login = (new BasicAttribute("userPrincipalName", "[email protected]"));
              Attribute sn = (new BasicAttribute("sn", "Chl"));
              Attribute pwd = new BasicAttribute("unicodePwd", "\"Ch@341\"".getBytes("UTF-8"));
    Attribute userAccountControl = new BasicAttribute("userAccountControl", "512");
              Attribute oc = new BasicAttribute("objectClass");
              oc.add("top");
              oc.add("person");
              oc.add("organizationalPerson");
              oc.add("user");
              // build the entry
              entry.put(cn);
              entry.put(street);
              entry.put(sn);
              entry.put(userAccountControl);
              entry.put(pwd);
              entry.put(login);
              entry.put(loginPreW2k);
              entry.put(oc);
              ctx.createSubcontext(entryDN, entry);

  • Accessing files in directory using Java SP in 10g

    Hi all-
    I have set up a directory in 10g which points to an existing directory in the operating system and am trying to get the list of files in it from a Java stored procedure. The directory in Oracle is called "Upload_to_Oracle" and am trying to get the files in the sp by calling:
    File f1=new File("Upload_To_Oracle");
    File fs[] =f1.listFiles();
    System.out.println("The count of files is " + fs.length);
    The problem is fs is null, so fs.length causes an exception to be thrown. Initially I was getting an error:
    the Permission (java.io.FilePermission Upload_To_Oracle read) has not been granted to ILFORD. The PL/SQL to grant this is dbms_java.grant_permission('ILFORD', 'SYS:java.io.FilePermission', 'Upload_To_Oracle', 'read')
    which I (think) I resolved by executing that command as SYS (this is a dev box used by just me) and logging out of sqlplus and back in.
    I haven't been able to find anywhere how you're supposed to reference an Oracle directory in Java, so in all honesty, I don't know if this is how you're supposed to do it.
    Any help would be appreciated.
    Thanks,
    Ilford

    I figured it out for anyone who needs something similar; the problem is that the Oracle directory is specific to particular files that Oracle will use for loading (BFiles, etc.). To get at the file system directory, I just needed to reference the actual system directory itself, as well as grant it permission.
    So what it comes down to is that you should reference the directory in File() as if it truly were a regular Java app on the filesystem, making sure the appropriate permissions are set for both the user running Oracle (for file/directory access) as well as for Java access.

  • How to change the properties of a directory using java code

    Hai All,
    I need to change the properties of directory( websharing).
    Can i do this using java code.
    Regards,
    Charan

    I need to change the properties of
    directory( websharing).
    an i do this using java code.Depends on whether the server has a Java API to do it. Most likely it hasn't.

  • New "Windows Programming Using Java" Website

    Our newly created "Windows Programming Using Java" website (http://fivedots.coe.psu.ac.th/~ad/winJava/) is for programmers who want to extend Java's capabilities on Windows XP and/or Vista, but aren't sure where to start. One of the drawbacks of Java's portability is that many Java programmers have a rather sketchy knowledge of Windows-specific programming.
    We plan to explain how Java applications can utilize Windows application software, OS features, and hardware beyond the reach of Java's standard libraries. A variety of Java/Windows programming techniques will be explained, including:
    * Java's employment of the Win32 API via C, JNI, and J/Invoke.
    * Java's utilization of Window's Command Line Interface (CLI) and batch files, accessed through Java's Runtime, ProcessBuilder, and Process classes.
    * Java and Windows object-based scripting, centered around the use of VBScript, Windows Script Host (WSH), and Windows Management Instrumentation (WMI).
    * Java interoperability with COM, including hosting of ActiveX controls in Swing containers using jacoZoom.
    This website is a work in progress, with four chapters available for download at the moment. We'll be adding more regularly, and would love feedback on what we're doing.
    Thanks,
    Gayathri Singh and Andrew Davison
    [email protected] and [email protected]
    Edited by: AndrewDavison on Jun 20, 2008 1:36 AM

    Hi, I am looking the similar kind of requirement that you had done.. Do you have any more details on the code that is working for you . All i need is if the user logs in successfully in windows, the the app should be accessible. Please let me know if you have the code with you on this problem.
    Thanks in advance
    "what i meant is the we b applications running in my system, when i access the application iam able to to login automatically with windows authentication and now in case of other users following process happened:"

  • How to create a virtual directory using EPG

    Hi,
    Can anyone tell me how to create a virtual directory in the EPG that points to a physical directory in the database server?
    Thanks,
    Andrew.

    You can create an Oracle directory that points to an operating system directory in the database product... Does that help?
    Thank you,
    Tony Miller
    Webster, TX
    There are two kinds of pedestrians -- the quick and the dead.
    If this question is answered, please mark the thread as closed and assign points where earned..

  • How to create a Directory using Java

    Hi friends,
    I want to create a file in side a directry. File should be place inside that directry. If directry is not exist then a new directory should be created.
    Eg., c:\upload\source\log.txt
    If the folder source is present inside the upload then there is no probs. If it does not exist then this foldder structure is needed to be created
    Thanks in advance,
    Balamurali

    Try reading the API documentation for the java.io.File class:
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
    Many questions like yours can be answered simply by reading the API.

  • Determin current working directory using java program

    HI:
    I would like to know is there anyway that I can determine what my current working directory is, using a java program??
    Thanks,
    Sincerely,
    Karen

    Properties sysProperties = System.getProperties();
    String currDir = sysProperties.get("user.dir");Here's a list of all the properties you can get from sysProperties:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getProperties()

  • Opening a new Broswer Window using Java code inside JSP

    Dear Fellow Java Developers:
    I have written a JSP that presents information about a particular item. I want to give an option to the customer to click on the picture of the item to get a larger view. However, I don't want the browser window that opens to have the usual buttons and menubar at the top like a typical browser window, I just want it to be a window with a large image of the item. A good example of this is on the following website:
    http://www.eddiebauer.com/eb/product.asp?product_id=24701&nv=2|21472|9|32&lview=&cm_cg=&tid=&c=&sc=&lp=w1i005
    Click on the picture of the shirt on this page and you'll see what I am talking about. How is this accomplished using a Java scriplet? I have checked the source code for the above site, as well as others, and they all achieve this using JavaScript. Is there a way of accomplishing this using pure Java and/or HTML?
    Just wondering.
    Thanks in advance to everyone that replies.
    Sincerely;
    Fayyaz

    you seem to miss the client/server side setup. Your java is executing on the SERVER and it processes a request which in turn sends pure HTML and javascript to the client. What you want to do has to be done on the CLIENT, so JavaScript is the only option.

  • Get os installed directory using java examples

    Hello...
    From my java program how can i find where i installed operating system. I want to get this both from windows and linux server.
    Please help me.....

    Sachb wrote:
    System Properties
    This link is what you are looking for.
    http://scv.bu.edu/Doc/Java/tutorial/java/system/properties.html
    no, not they dont.

  • How to create a directory or Folder  using java program?

    Hi all,
    Can any one know, how to create a directory(new folder) in java.
    can any give me some idea, on creating a directory using java program dynamically.
    thanx in advance

    hi thanks for your answer,
    sorry, actual i know this technique(its my fault i didnt mentioned it)
    i am looking for some what different technique.
    bye
    ram

  • Unzipping Files in Folder using Java

    Hello,
    I am working on a project and I am having trouble writing a program that will unzip all the files in a given directory (using Java). The directory is known, but the name and number of files to be unzipped will vary on each execution. The files need to be unzipped and then placed in a different specified folder.
    Thank you for your assistance.

    This should give you some idea. Be sure to import java.util.zip.
        /** unzipDirArchive */
        public static void unzipDirArchive(File inFile)
            throws IOException {
            ZipEntry entry = null;
            // Create stream to read the compressed file.
            ZipInputStream zis = new ZipInputStream(new FileInputStream((inFile)));
            // Create stream to write the output file.
            FileOutputStream fos = null;
            byte buffer[] = new byte[4096];
            int bytesRead;
            boolean dirCreated = false;
            // For each entry in the ZIP input file.
            while ((entry = zis.getNextEntry()) != null) {
                // If we have not created the enclosing directory.
                if (!dirCreated) {
                    // Create the directory.
                    int endIndex = entry.getName().lastIndexOf('/');
                    String dirName = entry.getName().substring(0, endIndex);
                    // DEBUG
                    // System.out.println("dirName is: " + dirName + ".");
                    File newDir = new File(dirName);
                    // Check if the output dir already exists.
                    if (newDir.exists()) {
                        System.err.println("Uncompress: Output directory " + dirName +
                                           " already exists.");
                        System.exit(-5);
                    else {
                        // If we successfully created the enclosing directory.
                        if (newDir.mkdir()) {
                            dirCreated = true;
                        else {
                            System.err.println("Uncompress: Cannot create directory " +
                                                dirName + ".");
                            System.exit(-6);
                    } // end if newDir.exists
                } // end if !dirCreated
                System.out.println("Inflating: " + entry.getName());
                fos = new FileOutputStream(entry.getName());
                // Copy the data from the ZIP file entry to a file.
                while((bytesRead = zis.read(buffer)) != -1)
                    fos.write(buffer, 0, bytesRead);
                fos.close();
            } // end while more entries in the ZIP file
            zis.close();
        } // end method unzipDirArchive

Maybe you are looking for

  • My ten AT&T/Yahoo! email addresses slowly stopped working ...

    All were set up as IMAP accounts and all addresses are of the @sbcglobal.net type.  Even though I could log into the same accounts via the web using Safari, and all passwords are stored in my Keychain, the Mail app was rendered useless by popdowns co

  • How to stor special characters in a VARCHAR2 field?

    I am trying to store a encrypted string into a 'varchar2' field. But, the encrypted string is not stored properly. Some characters are stored incorrectly. Can anybody help me in storing an encrypted string into a varchar2 field??

  • Getting JTA Error Messages in MII Transaction

    Hi ,            I am using a JTA action block to insert the data in a table. In case this insert statments throws any error (such as primary key violation or column length issue)  I would like to display that error message to the user. Can any one kn

  • ITunes still not syncing correctly with iPhoto 9.4.3

    Since upgrading to version 9.4.x, iTunes hasn't been syncing correctly with iPhoto. There were duplicated events/albums, missing photos, photos not appearing in the same order on iOS devices as they do in iPhoto, etc. With each version upgrade since

  • Include Tool cost in Standard cost of material

    Hi I have a scenario  where we use  consumable tools in manufacturing the end product , which is 'nut'. We use roughly 80 tools in the manufacturing process. Each tool has its life. For eg. Tool A will be used to manufacture 10,000,000 nuts. The prod