Can't set directory path in a JTextField

I've tried to set some directory paths in a JTextField, but nothing displayed in that the JTextField. However, i can print the directory paths one at a time to the console. The following is the code and will explain what I am trying to do:
fileDialog.showOpenDialog(this);
File[] classpath = fileDialog.getSelectedFiles();
if(classpath.length == 0)
return;
String cp = "";
for(int i = 0; i<classpath.length; i++){
//System.out.println(classpath.getPath());
cp.concat(classpath[i].getAbsolutePath());
System.out.println(cp);
jTextField_cp.setText(cp);
if I uncomment the first print statement,each path will be shown on a new line in the console. But when I want to print the pathes of the directories in one time( concatenate them first), there's no output at all (the second print statement), I only got some empty new lines in the console. Is it any problems with the use of "cp.concat()" method?

I'm pretty sure that it'll work if you replace your concat line with this.
cp = cp.concat(classpath.getAbsolutePath());Java strings are passed by the value of their references, so you are only manipulating the value of the reference, the the string itself, unlike other objects. To work around that, assign cp the new string returned from the concat method.

Similar Messages

  • How can i set a path for my deployment files in weblogic server 10.3

    Hi
    How can i set the path for my WAR ,JAR files while deploying.i am using the wls10.3 version.
    is there any scripts for this ,please provide me.
    my Application is ADF 11g application.

    By "path", I assume you mean "classpath".
    The simplest way is simply to include the jars you need inside the web application or web module's WEB-INF/lib directory, EJB module's META-INF/lib directory, or EAR lib directory.
    If that's not practical, if you use NodeManager to start your servers, you can go to the "Server Start" tab in the server definition in the WebLogic console and edit the "Classpath" field, which defaults to no value. You can specify a classpath value there. Note that if you specify a value there, it REPLACES the default classpath for the server, it doesn't add to it. If you need to just add to it (a much more likely scenario), if the value references the value "$CLASSPATH" in it, that will reference the original classpath value that the server would have had.
    So, for instance, if you wanted to include the MQ jars in the server classpath, you could set a value like this:
    /usr/java/mq/lib/mq.jar:/usr/java/mq/lib/mqstuff.jar:$CLASSPATH

  • How can I set a gap in a JTextField, before the active Textfield starts?

    Hi,
    how can I set a gap in a JTextField, before the active Textfield starts?
    I'll avoid, that the input text starts immediately after the border of the JTextField.
    Btw, how can I set the height of the JTextField in a BoxLayout?
    Thx.
    Hans

    Yes, that was also my thinking, but nothing happens.
    Maybe You have an idea :-)
    Thx, Hans
    Here a part of my code:
      private JPanel createEntry(String label, JTextField jtf, String initJtf, boolean editable) {
        jtf.setColumns(15);
        if (editable) {
          jtf.setEditable(true);
          jtf.setBackground(new Color(191, 191, 255));
        else {
          jtf.setEditable(false);
          jtf.setBackground(SystemColor.control);
        jtf.setText(initJtf);
        jtf.setForeground(Color.black);
        jtf.setBorder(BorderFactory.createLoweredBevelBorder());
        jtf.setMargin(new Insets(50, 20, 50, 40));   // <-  The PROBLEM
        JPanel panel = new JPanel();
        GridLayout gl = new GridLayout(1, 2);
        gl.setHgap(1);
        panel.setLayout(gl);
        panel.add(BxpCdmUtils.Utils.createLabel(label, Color.darkGray, Font.BOLD, 11));
        panel.add(jtf);
        JPanel superpanel = new JPanel();
        superpanel.setLayout(new BoxLayout(superpanel, BoxLayout.X_AXIS));
        superpanel.add(panel);
        superpanel.add(new JLabel(" "));
        return superpanel;
      }

  • How can i set class path in ubuntu JAVA_HOME ?

    how can i set class path in ubuntu <JAVA_HOME>?

    Note that on *nix
    environment variable names are case sensitive.
    Also, you are again being vague; is it [this it|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html] or [that it|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/java.html]

  • Dynamic Configuration - Set Directory Path for File Receiver Adapter

    Hi Experts,
    I have a question regarding the dynamic configuration for the file adapter. Is it possible to set a directory path without a message mapping for the file receiver adapter? the problem is that I want to import a pdf document. this pdf document I want to store in a dynamic directory (depending on the filename). so I have to read the filename out of the dynamic configuration and generate (depending on the filename) a directory for this file. Is that possible without a message mapping? I cannot make a message mapping because the file has the pdf format and should not get changed.
    best regards
    Christopher Kühn

    Hi Gaurav,
    I use the ASMA (respectively the filename) for the sender adapter. After the pdf was imported into XI this filename is in the ASMA.
    But what then??? How can I get this filename with the help of the variable substitution? and if I have this filename I have to change this filename a bit to generate the name / path of the directory.
    Please explain it to me detailled
    Thanks and regards
    christopher

  • How can I set a path for a new AD-User in this Switch example?

    Hi,
    I am nearing the end of my script that creates a new ad user, adds them to a set of groups, and moves them to their correct ou.
    The problem I have is that I cant work out how to move them to the OU.
    eg.
    Step 1. In my function I have completed the part that creates the user, and I have used the -passthru parameter to return the new user object into a variable called $obj.  
    Step 2. I have created a switch that accepts a department variable, and adds the user to the corresponding groups.
    Step 3. Finally I want the user to be created in an OU that is relevant to their job role. If possible in the same switch as above.
    Here is the switch :
    Switch($dept)
    Finance {$FinanceGroups = @("Finance","Users");ForEach($group in $FinanceGroups){Add-ADGroupMember -Identity $group -Members $Obj}}
    Sales {$SalesGroups = @("Sales","Users");ForEach($group in $SalesGroups){Add-ADGroupMember -Identity $group -Members $Obj}}
    Support {$SupportGroups = @("Support","Users");ForEach($group in $SupportGroups){Add-ADGroupMember -Identity $group -Members $Obj}}
    I was trying to do it like this.
    Finance{$FinanceGroups=@("Finance","VPN_Users");ForEach($groupin$FinanceGroups){Add-ADGroupMember-Identity$group-Members$Obj}{$Obj.Path ="OU=Staff,OU=Accounts,OU=Resources,DC=homenet,DC=com"}}
    But it doesn't seem to work, and I think the problem could be that the new user object returned by the -passthru parameter is read only. So I can't set it's parameters.
    Can you think of a way to do it?
    Thanks

    I would re-write this function as follows:
    Function New-User {
    [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')]
    Param(
    [Parameter(Mandatory=$true,
    ValueFromPipeLine=$true,
    ValueFromPipeLineByPropertyName=$true,
    Position=0)]
    [String]$fname,
    [Parameter(Mandatory=$true,
    ValueFromPipeLine=$true,
    ValueFromPipeLineByPropertyName=$true,
    Position=1)]
    [String]$sname,
    [Parameter(Mandatory=$true,
    ValueFromPipeLine=$true,
    ValueFromPipeLineByPropertyName=$true,
    Position=2)]
    [ValidateSet("Milan","London","tokyo")]
    [String]$site,
    [Parameter(Mandatory=$true,
    ValueFromPipeLine=$true,
    ValueFromPipeLineByPropertyName=$true,
    Position=3)]
    [ValidateSet("Finance","Sales","Support")]
    [String]$dept,
    [Parameter(Mandatory=$false,
    ValueFromPipeLine=$true,
    ValueFromPipeLineByPropertyName=$true,
    Position=4)]
    [String]$baseOU = "OU=Accounts,OU=Resources,DC=homenet,DC=com",
    [Parameter(Mandatory=$false,
    ValueFromPipeLine=$true,
    ValueFromPipeLineByPropertyName=$true,
    Position=5)]
    [String]$tempPass = "Temp-pass1"
    Write-Verbose "Creating user '$fname $sname' in OU 'OU=$dept,$baseOU'"
    $objUser = New-ADUser -name "$fname $sname" `
    -GivenName $fname `
    -Surname $sname `
    -DisplayName "$fname $sname" `
    -SamAccountName "$fname.$sname" `
    -AccountPassword ($tempPass | ConvertTo-SecureString -AsPlainText -Force ) `
    -ChangePasswordAtLogon:$true `
    -Path "OU=$dept,$baseOU" `
    -PassThru
    $Groups = @("All_$site","Users","$dept")
    Write-Verbose "Adding user '$fname $sname' to groups '$($Groups -join ', ')'"
    $Groups | % { Add-ADGroupMember -Identity $_ -Members $objUser.DistinguishedName }
    Write-Verbose "Enabling user account '$fname $sname'"
    Enable-ADAccount -Identity $objUser.DistinguishedName
    <#
    Examples
    New-User -fname "Sam" -sname "test" -site Milan -dept Finance -Verbose
    #>
    Notice:
    Function name: follows verb-noun format - best practice 
    $obj variable renamed to $objUser - using variable name that reflects its content
    Use of CmdLetBinding[] and confirm impact as high since you're writing to AD 
    Use of ValidationSet to minimize parameter input errors
    Parameterized baseOU, and TempPass
    Added requirement to change password at first logon
    Enabling the account at the end
    You should wrap each of the 3 steps in a try-catch block. Check for things like user already exists or not, group exists r not, OU exists or not..
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

  • My iWeb can't find directory/path at GoDaddy

    I can't make a test connection via the FTP on iWeb's publish page. Keeps saying "the directory/path couldn't be found. Verify your settings and try again."
    I've searched the forum here and called GoDaddy for help. The tech there told me that I'm making a connection but my software can't find the "root folder" at my domain.
    Help?????

    I'm gonna answer my own question/problem in case anyone else encounters the same.
    Instead of publishing to FTP service, I published to a folder on my computer. Then I was able to manually upload the files, like I'd been doing in the past, using the GoDaddy FTP service. Mission accomplished.

  • Set directory path

    I have to call native applications from within my java application (using the Runtime.getRuntime().exec() method). That works fine but I need to change the current directory path to a specific path.
    How it is done to change the current directory path with java ?
    Steffen Kux.

    You can use one class of mine that I already posted to this forums some time ago...
    /** executes multiple commands in one shell
    * @author: Giorgio Maone
    import java.io.*;
    public class MultiExec {
    static final boolean IS_WIN=System.getProperty("os.name").toLowerCase().indexOf("win")==0;
    protected String shell=IS_WIN?"":"sh";
    public void setShell(String s) {
       shell=s;
    public String getShell() {
       return shell;
    public Process exec(String cmds[]) throws IOException {
      File f=File.createTempFile("muexec",".bat");
      PrintWriter out=new PrintWriter(new FileWriter(f));
      if(IS_WIN) out.println("@echo off");
      for(int j=0,len=cmds.length; j<len; j++)
        out.println(cmds[j]);
      out.close();
      f.deleteOnExit();
      return Runtime.getRuntime().exec(shell+" "+f.getCanonicalPath());
    public int execAndWait(String cmds[]) throws IOException {
       Process p=exec(cmds);
      new Pipe(p.getInputStream(),System.out).connect();
      new Pipe(p.getErrorStream(),System.out).connect();
      new Pipe(System.in,p.getOutputStream()).connect();
      int exitCode=-1;
      try {
       exitCode=p.waitFor();
       } catch(InterruptedException ex) {}
      return exitCode;
    static class Pipe {
       private InputStream in;
      private OutputStream out;
      public Pipe(InputStream in, OutputStream out) {
        this.in=in; this.out=out;
      public void connect() {
        new Thread() {
         public void run() {
          try {
           for(int b;(b=in.read())!=-1;) {
             out.write(b);
           out.flush();
         } catch(IOException ex) {}
       }.start();
    // Test code
    public static void main(String[] args) throws Exception {
    String path=args[0];
    String drive=path.indexOf(":")==1?path.substring(0,1):"";
    System.out.println("\nExit code:"+
      new MultiExec().execAndWait(
       new String[]{
        drive,
        "cd "+path,
        args[1];
    }

  • Want to output only the directory path in the jTextField

    Currently, I am getting the directory path, but need to select a file inside it, then only the directory path gets selected in the jTextField1. Please tell me how do I get the directory path in jTextField1 by selecting only the directories in jButton1.
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
         JFileChooser dirchoose=new JFileChooser();
         dirchoose.setCurrentDirectory(curfile);
         String directory=dirchoose.getCurrentDirectory().toString();
         int stat=dirchoose.showOpenDialog(this);
         if(stat==JFileChooser.APPROVE_OPTION)
              curfile=dirchoose.getCurrentDirectory();
              jTextField1.setText(dirchoose.getCurrentDirectory().toString());
              String jTextField1Text=jTextField1.getText();
    File curfile=new File("C:\\");

    Please ignore this topic. I am new here and was bit confused with the forum.

  • How can I set the PATH properly in XP?

    Ive stuffed around for hours trying to do this. Ive installed j2eesdk-1_4_2004Q4-beta-windows.
    I wrote a simple app in jGrasp, then hit compile and it comes up with
    "package javax.ejb does not exist
    import javax.ejb.*;"
    Now my PATH looks something like this
    C:\Sun\AppServer\bin;C:\Sun\AppServer\jdk\bin;C:\Sun\AppServer\lib\j2ee.jar;
    this just doesnt work....
    Can someone who writes j2ee apps in XP plz let me know how to set up the class path so i dont get these package not found errors.
    It would be a great favour, thank you.
    PS when i move the j2ee.jar file into the jre\lib\ext folder it compiles, but this seems dodgy to me. Plz help me.

    Either set the classpath pointing to j2ee.jar when building your app (javac -classpath ...\j2ee.jar) - if you are using ant scripts to build, checkout the samples or blueprints applications for examples of how to set the classpath within ant scripts
    Or set your CLASSPATH environment to ...\j2ee.jar (My Computer->Control Panel->System->Advanced->Environment Variables
    Hope this helps

  • Can I set the AuthoredContents.xml path?

    Hi,
    I need help about the following issue:
         Can I set the path where Ill have the authoredContents.xml and how?
    I need to put the authored content.xml in a different path of root directory. Maybe , its possible setting by FlashVars?
    Thanks

    I have a flex application that generates an swf taht we call util.swf In my flex tool, util.swf, I have a swfLoader that includes a FlashDvd.swf.
    <swfLoader id="encorePlayer" source="./encore/FlashDVD.swf"/>
    I have a folder called encore that contains FlashDVD.swf, Sources and AuthoredContent.xml
    When i load the tool the player is shown but the contents no.
    I thought, ok, Ill try to put the AuthoredContent.xml in the root directory of my app, and then the app with the player runs ok, being the eschema like this
    ./index.html
      util.swf
      authoredContents.xml
      encore
        sources
        FlashDVD.swf
    Ill need that my application can use FlashDVD.swf with the authoredContents.xml in the same  folder encore because Ill have several folder with FlashDVD.swf, and about that I need to indicate to FlashDVD.swf where is the authoredContent.xml

  • I want to set context path to ""

    Can I set context path to "" like as Tomcat ?
              tomcat server.xml
              <Context path="" docBase="webapps/ROOT" debug="0" reloadable="true"
              >
              </Context>
              I set weblogic.properties as below
              weblogic.httpd.webApp.=C:/somewebapp
              It seems to work well.
              But actually WLS see weblogic/myserver/public_html.
              Please give me any advise.
              Thanx.
              ikedatka
              

    I think what you are looking for is called the "default web application",
              which answers to the "/" path. Luckily someone else already answered this
              question, so I can look intelligent:
              > The answer is to set up a weblogic property:
              >
              > weblogic.httpd.defaultWebApp=<web-app-name>
              >
              > If you do this you don't need to type:
              >
              > http://localhost:7001/<web-app-name>/<the-rest-of-the-URL>
              >
              > you can just say
              >
              > http://localhost:7001/<the-rest-of-the-URL>
              >
              >
              > --kumar allamraju
              Peace.
              Cameron Purdy
              "ikedatka" <[email protected]> wrote in message
              news:[email protected]..
              > Can I set context path to "" like as Tomcat ?
              >
              > tomcat server.xml
              > <Context path="" docBase="webapps/ROOT" debug="0"
              reloadable="true"
              > >
              > </Context>
              >
              > I set weblogic.properties as below
              >
              > weblogic.httpd.webApp.=C:/somewebapp
              >
              > It seems to work well.
              > But actually WLS see weblogic/myserver/public_html.
              >
              > Please give me any advise.
              > Thanx.
              >
              > ikedatka
              >
              

  • How can I set a new directory path for iPhoto lib & photos?

    I'd like to use an external drive to house all the iPhoto related files including the Library, data files and photos. I don't see an iPhoto Preference to set a different path. Is there another method to accomplish this? Should I edit the directory path as listed in the AlbumData.xml file?
    Thanks!

    Hi Nova,
    copy the ENTIRE iPhoto Library folder (in your Pictures folder) to the external.
    Launch iPhoto with the Option key held down.
    At the prompt choose to open another library
    Navigate to the library on the external and choose it.
    Once it opens on the external this is the library iPhoto will use.
    You can then delete the one on the internal or save it as backup or burn it for backup.

  • How can I get rid of directory path in front of my folder names in Folder listing in Library mode???

    Im using the most recent version of Lightroom 5.3 (updated through CC - even though this has shown up on previous version) on Windows 7 and all the folders in my library are showing up with the directory path in front of my folder names. How can I get rid of this? I do not see any options in preferences to turn this off. I have also turned off preferences in Windows > Folder Options Control Panel "Display full Path in Title bar" option.
    I have Lightroom on several computers and have set up preferences the same on each workstation, and this only shows up on one workstation.
    Any help would be appreciated.
    You can see from the image  below how this is showing up.
    Thanks
    Thanks!

    Click the little down arrow/+ symbol  next the + - in the folders bar.

  • Set default directory/path for SaveAs Dialog using WPG_DOCLOAD

    Hi, im trying to set the default directory/path for the SaveAs Dialog called by wpg_docload.download_file.
    I'm not able to find where I can specify the default path.
    Is it something like "htp.p('Content-Disposition: attachment; path=:PX_OUTPUT_DIR" ?
    Thx for your help !
    Here's a part of my code
    owa_util.mime_header( NVL(mime,'application/octet'), FALSE );
    htp.p('Content-length: ' || length);
    htp.p('Content-Disposition: attachment; filename="'||substr(fileName,INSTR(fileName,'/')+1)|| '"');
    owa_util.http_header_close;
    wpg_docload.download_file( lobLoc );
    /*********************/

    I don't believe you're allowed to set the directory path in the Content-Disposition (or any other) header. More accurately, you can set path in the filename, but browsers don't pay any attention to that, they only look at only the terminal filename.
    <p>According to RFC 2183, browsers are supposed to ignore any path information sent with the filename. Even though it's dated 1997, I believe this RFC is still in effect.
    <p>This was done as a security precaution against malicious web apps that might try to download into a system directory or other dangerous place. Also, browsers (usually) allow users to specify their own default download directories. Further, even if you could specify the path, you'd have to do it for any and all filesystems (Linux, Mac HFS, Mac OSX, Windows, etc etc).

Maybe you are looking for