Java.io.file filename format?

Hi,
When using java.io.file to read filenames in a directory, which format is the resulting string (ie unicode, utf-8, system dependant)? When I read a directory with chinese characters, the output to screen is question mark.
I know this could be a problem with output but I have no idea where to start to test that.
Thanks for any help!

What am I missing? I don't see a point to this post.

Similar Messages

  • Java.io.File give incorrect chinese filenam when using javaw.exe

    I am running Chinese Win2000 Pro (SP2) with jre1.3.1 installed. If I use javaw.exe to run my application, java.io.File does not give the correct filename for chinese filename when I use it to run through a directory, though all English filenames show correctly.
    When the same program is run by java.exe instead of javaw.exe, the program runs with no problem and all chinese name are obtained successfully from java.io.File. Does anyone know the reason behind this ?
    I need to use javaw.exe since I am invoking Java from VC++. I don't want a black command prompt window to pop up behind my java application. Please help.

    Hi,
    I am sorry for not replying to ur query. Infact I am facing my own problem and after reading your problem I thought you could help me out in it because you are already successful in invoking java from VC++.
    My problem is that I want to invoke java class from VC++ in such a way that I want to capture the stdout of java class that I invoke from VC++ and use it in VC++. Let me explain first thing first. I am not able to invoke java class from withing vc++. I have looked at JNI help on SUN site but it is giving me lots of compilation error when I include JNI.h in my VC++ program. If you could help me out in this problem, it would be great.
    Thanks in advance.
    Regards
    Rakesh

  • Filename Format in FTP Delivery Channel - oracle.tip.adapter.b2b.allTPInOne

    Hi,
    For Inbound SFTP transfer is there a way to avoid using standard B2B file-naming convention at source files?
    We tried the following for B2B host external delivery channel (SFTP) which would pick up the files from trading partner directory -
    1. Set oracle.tip.adapter.b2b.allTPInOneDirectory = false
    2. Create a directory specific to the trading partner and have the Trading Partner drop the files in the Trading Partner specific folder.
    However, it did not work; the transfer was successful only when standard file name format was specified and used for files.
    We are using 'Oracle B2B 10.1.2 MLR16' version - is this feature not available in this version?
    Sincerely,
    CD

    Thanks Anuj
    It throws the following error now -
    Description: Unable to identify the document protocol of the message
    StackTrace:
    Error -: AIP-50083: Document protocol identification error
         at oracle.tip.adapter.b2b.engine.Engine.identifyDocument(Engine.java:3354)
         at oracle.tip.adapter.b2b.engine.Engine.processIncomingMessage(Engine.java:1725)
         at oracle.tip.adapter.b2b.engine.Engine.incomingContinueProcess(Engine.java:2657)
         at oracle.tip.adapter.b2b.engine.Engine.handleMessageEvent(Engine.java:2527)
         at oracle.tip.adapter.b2b.engine.Engine.processEvents(Engine.java:2482)
         at oracle.tip.adapter.b2b.data.MsgListener.onMessage(MsgListener.java:530)
         at oracle.tip.adapter.b2b.data.MsgListener.run(MsgListener.java:376)
         at java.lang.Thread.run(Thread.java:534)
    These are the details for the Inbound transfer -
    preserve filename=true
    filename=SampleFile.txt
    filename format (specified in host external delivery channel) =%FROM_PARTY%_%TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%
    fullpath=/../SystemB/SampleFile.txt SystemB is the remote trading partner (FROM_PARTY); it has generic identifier created with same name.
    The transfer works if the filename is in this format: %FROM_PARTY%_%TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%. Do any of the other parameters for delivery channel such as directory name format, Directory name format separator need to be used/updated?
    Thanks,
    CD

  • Trying to write data to a text file using java.io.File

    I am trying to create a text file and write data to it by using java.io.File and . I am using JDeveloper 10.1.3.2.0. When I try run the program I get a java.lang.NullPointerException error. Here is the snippet of code that I believe is calling the class that's causing the problem:
    String fpath = "/test.html";
    FileOutputStream out = new FileOutputStream(fpath);
    PrintStream pout = new PrintStream(out);
    Do I need to add additional locations for source files or am I doing something wrong? Any suggestions would be appreciated.
    Thank you.

    Hi dhartle,
    May be that can help:
    * Class assuming handling logs and connections to the Oracle database
    * @author Fabre tristan
    * @version 1.0 03/12/07
    public class Log {
        private String fileName;
         * Constructor for the log
        public Log(String name) {
            fileName = name;
         * Write a new line into a log from the line passed as parameter and the system date
         * @param   line    The line to write into the log
        public void lineWriter(String line) {
            try {
                FileWriter f = new FileWriter(fileName, true);
                BufferedWriter bf = new BufferedWriter(f);
                Calendar c = Calendar.getInstance();
                Date now = c.getTime();
                String dateLog =
                    DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM,
                                                   Locale.FRANCE).format(now);
                bf.write("[" + dateLog + "] :" + line);
                bf.newLine();
                bf.close();
            } catch (IOException e) {
                System.out.println(e.getMessage());
         * Write a new line into a log from the line passed as parameter,
         * an header and the system date
         * @param   header  The header to write into the log
         * @param   info    The line to write into the log
        public void lineWriter(String header, String info) {
            lineWriter(header + " > " + info);
         * Write a new long number as line into a log from the line 
         * passed as parameter, an header and the system date
         * @param   header  The header to write into the log
         * @param   info    The line to write into the log
        public void lineWriter(String header, Long info) {
            lineWriter(header + " > " + info);
         * Enable to create folders needed to correspond with the path proposed
         * @param   location    The path into which writing the log
         * @param   name        The name for the new log
         * @return  Log         Return a new log corresponding to the proposed location
        public static Log myLogCreation(String location, String name) {
            boolean exists = (new File(location)).exists();
            if (!exists) {
                (new File(location)).mkdirs();
            Log myLog = new Log(location + name);
            return myLog;
         * Enable to create the connection to the DB
         * @return  Connection  Return a new connection to the Oracle database
        public static Connection oracleConnectionCreation() throws Exception {
            // Register the Oracle JDBC driver
            DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
            //connecting to the DB
            Connection conn =
                DriverManager.getConnection("jdbc:oracle:thin:@myComputerIP:1521:myDB","user", "password");
            return conn;
         * This main is used for testing purposes
        public static void main(String[] args) {
            Log myLog =
                Log.myLogCreation("c:/Migration Logs/", "Test_LinksToMethod.log");
            String directory = "E:\\Blob\\Enalapril_LC-MS%MS_MS%MS_Solid Phase Extraction_Plasma_Enalaprilat_ERROR_BLOB_test";
            myLog.lineWriter(directory);
            System.out.println(directory);
    [pre]
    This class contained some other functions i've deleted, but i think it still works.
    That enables to create a log (.txt file) that you can fill line by line.
    Each line start by the current system date. This class was used in swing application, but could work in a web app.
    Regards,
    Tif                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Custom File Name Format in B2B Console

    Hi,
    Please let me know if we can have a customized File Name Format in the B2B Console for the X12 EDI/XML Files.
    I have read the Oracle doc and only the following formats are mentioned:
    %FROM_PARTY%
    %TO_PARTY%
    %DOCTYPE_NAME%
    %DOCTYPE_REVISION%
    %MSG_ID%
    %TIMESTAMP%
    Is there a way to have a PO# (From the Trading Partner Payload) in the filename format?
    You help is appreciated.
    Thanks
    Priyanka G

    no. It has the format which helps B2B in identifying the agreement

  • Getting all the members (variables, methods AND method bodies) of a java source file

    For a project I want to programmatically get access to the members of java source file (member variables, methods etc) as well as to the source code of those members. My question is what is the best method for this? So far I have found the following methods:
    Use AST's provided by the Java Source API and Java Tree API, as discussed in the following posts:
    http://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html
    http://weblogs.java.net/blog/timboudreau/archive/2008/02/see_java_code_t.html
    http://netbeans.dzone.com/announcements/new-class-visualization-module
    This has the disadvantage that the classes actually have to be compilable. When I look at the Netbeans Navigator view however, it provides me with a nicely formatted UI list, regardless of the "compilable" state of the class.
    Thus I started looking at how to do this... The answer appears to be through the use of tools such as JavaCC: https://javacc.dev.java.net/
    ANTLR: http://www.antlr.org/
    which are lexers and parsers of source code. However, since the Navigator panel already does this, couldn't I use part of this code to get me the list of variables and methods in a source file? Does the Navigator API help in this regard?
    Another route seems to be through tools such as
    BeautyJ: http://beautyj.berlios.de/
    which run on top of JavaCC if I am correct, and which has the ability to provide a clean view on your java code (or an XML view). However, BeautyJ does not seem to be too actively developed, and is only j2se1.4 compatible.
    I hope someone can shed a light on the best way to go about what I want to achieve. Somebody already doing this?
    (I crossposted on the Netbeans forums too, hope this is OK...)

    I'm currently developing a LaTeX editor(MDI) and I do the same thing, but I don't know what exactly do you need.

  • How to read the java class file to convert it in java.

    hello all,
    i m developing the java application which generated the java code from the java 'class file' .
    Can anybody please help me, Is any java support for reading the class file? or how to know the class file format?
    I know the application javad, jad, javap which is doing the same thing.
    thanks for reply,
    - Jayd

    do you mean decompiling? there are tons of java decompilers available out there, what exactly are you trying to do here?

  • How to convert a .jsp to a .java/.class file for use in peoplesoft

    Hi java/jsp experts,
    I want to convert a .jsp to a .java/.class file. is there a tool available, please let me know if you have any pointers....
    or can i do it manually:
    these are a few lines that the .jsp contains, and i would like to translate this to be in .java/.class format:
    <%@ page import="sun.misc.BASE64Encoder, javax.crypto., javax.crypto.spec."%>
    <%@ page import="java.util.StringTokenizer" %>
    <%@ page import="java.util.Map" %>
    <%!
    sb.append("<input type=\"hidden\" name=\"orderPage_serialNumber\" value=\"");
    sb.append(serialNumber);
    sb.append("\">\n");
    return sb.toString();
    %>
    how can i translate the above import statements and html elements from jsp to java, please let me know.
    Once i have the .java file created from the .jsp, I will compile .java to create the .class file and invoke the .class in peoplecode by using java apis available in peopletools.
    Thanks in advance.

    Is there a way convert a binary .exe file( compiled by
    another compiler) into Java .class/.jar file ? Anyone
    know of a free program that can do this?It's not possible. There are many decompilers and disassemblers for Java but nothing will take you from ANY binary to Java source. It would be the end of computing as we know it and the beginning of a new era -:)

  • UNC paths and java.io.file in Oracle

    Hi,
    I'm just getting to grips with using some basic java in the database. I'm using 8.1.7 on W2K.
    I'm trying to test for the existance of a file on a separate w2k domain:
    import java.io.File;
    public class JFileExists {
    public static int fileexists (String fileName) {
    File myFile = new File (fileName);
    boolean retval = myFile.exists();
    if (retval) return 1; else return 0;
    public static void main (String args[]) {
    System.out.println (
    fileexists (args[0])
    grant javasyspriv to mp;
    function jfn_file_exists (file_in IN VARCHAR2) RETURN number
    AS LANGUAGE JAVA NAME 'JFileExists.fileexists (java.lang.String) return int';
    From the command prompt all is well:
    E:\java>"c:\oracle\ora81\Apache\jdk\bin\java.exe" JFileExists i:\test.txt
    1
    E:\java>"c:\oracle\ora81\Apache\jdk\bin\java.exe" JFileExists \\mpweb1\image\test.txt
    1
    But when loaded into oracle its returning false with the UNC path. (but is ok with a mapped drive to the same path)
    SQL> declare
    2 begin
    3 pa_main.pr_print(to_char(pa_main.jfn_file_exists('I:\test.txt')));
    4 pa_main.pr_print(to_char(pa_main.jfn_file_exists('\\mpweb1\image\test.txt')));
    5 end;
    6 /
    1
    0
    PL/SQL procedure successfully completed.
    The oracleservicesid and listener are starting under a user called oracle_user which is a member
    of the admins and domain admins group.
    mpweb1 is on a separate domain to the database server mpdb1 but it also has a user called oracle_user with the same password.
    oracle_user has full access to the share in question.
    Am I missing something? I was trying to keep the database server and web server on different domains for better security
    - but would things be easier if they were on the same domain?
    Any help much appreciated for this java newbi!
    Thanks,
    Simon.
    null

    I am also having problems with UNC paths. But I cannot access the location even if it is mapped as a drive. In JDK VJM I do not have a problem, but in Oracle it says the file cannot be found and say permission denied. I will try to change the user that starts the database and see if that helps.
    null

  • Java.io.File only returns similar file names

    I have written a bean which reads a directory and places the file names in an array, which can be accessed by a JSP page. At first, the files inside the directory were named wb_1.jsp, wb_2.jsp, wb_3.jsp and so on. When I change a filename to something like work.jsp, it still appears in the file list, but when I rename it to something like identify.jsp, it doesn't!
    If I count the array, it does read the correct number of files.
    Class FileHandler
    // Imports
    import java.io.File;
    // Class
    public class FileHandler
         // Constants and variables
         public File dir;
         public File[] files;
          * Returns the number of files found inside the given directory
         public int showFiles()
              try
                   setDir(getDir());     // Get file directory as set in the bean property
                   files = dir.listFiles();     // List the files found inside the directory
              catch (Exception e)
                   System.out.println(e + " : No files found to return a value");
              return files.length;      // Return the number of files
          * Returns the file name by using the in value in the files array
         public String returnFileName(int in)
              return files[in].getName();     // Return the name of the file
          * Sets dir file type to the setproperty value in
         public void setDir(File in)
              dir = in;     // Set class variable value for dir
          * Returns the dir value
         public File getDir()
              return dir;     // Return the setproperty value for dir
    }And the JSP code which reads the array
    out.println("<select onChange=\"jumpMenu('top',this,0)\" size=\"5\" style=\"width: 200\"");
    String fileName = new String();
    for(int x=0; x<file.showFiles(); x++)
         fileName = file.returnFileName(x);
         out.println("<option selected value=\"beheer.jsp?action=2&file=" +  fileName + "\">" +  fileName +"</option>");
    out.println("</select>");

    I forgot bean properties im the above code lines. Here it is, just in case.
    <jsp:useBean id="file" class="FileHandler" scope="page" />
    <jsp:setProperty name="file" property="dir" value="C:\\IBM Websphere workspace\\Project\\Web Content\\WEB-INF\\include" />

  • Output file name format

    Hi All,
    How can i configure output file name to the desired format generated in target directory in communication channel configuration in conf scenario.
    ex: i want to generate the file in the below format..
    YYYYMMDD_<Receiver>.TXT
    Thanks and Regards
    Venkatesh

    Hi,
    This is the UDF u have to write in Mapping,
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key =
    DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName;
    Using this u will get the File name into target side,In this UDF add the Time stamp.
    Check this link for more details.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards,
    phani
    Reward points if Helpful

  • Log file's format in expdp\impdp

    Hi all,
    I need to set log file format for expdp\impdp utility. I have this format for my dump file - filename=<name>%U.dmp which generates unique names for dump files. How can i generate unique names for log files? It'd better if dump file name and log file names will be the same.
    Regards,
    rustam_tj

    Hi Srini, thanks for advice.
    I read doc which you suggest me. The only thing which i found there is:
    Log files and SQL files overwrite previously existing files.
    So i cant keep previos log files?
    My OS is HP-UX (11.3) and database version is 10.2.0.4
    Regards,
    rustam

  • Unicode support in java.io.File.listFiles()

    I am trying to list all the files in a given directory using the File.listFiles() method, yet for some reason the File objects returned have invalid paths when a file has unicode characters in its filename.
    example .. a test directory has these files
    tiga-dj_kicks.mp3
    tr\374by_trio-elevator_music.mp3
    if i call dir.listFiles() i will get ...
    tiga-dj_kicks.mp3
    tr?by_trio-elevator_music.mp3
    why is java converting my unicode into "?"s?
    i have seen other java apps that don't have this problem ... does anyone know why this is happening?
    in terms of my system ... i am on linux 2.4.20 in the US and i have tried may jdk versions including 1.3.1 and the latest 1.4.2 as well as blackdown 1.4.1

    It's true that System.out may not like unicode characters, so I instead I have been using a JTextArea and I know that supports my unicode.
    **eek ... after a preview it seems that my unicode isn't going to show up here either :( i'll wrap brackets around what was actually displayed as unicode in my environment.
    here is another test I have run ... println(String) just appends to the text area
    String original = new String("A" + "\u00ea" + "\u00f1" +
                   "\u00fc" + "C");
    println(original);
    File f = new File(original);
    println(f.getPath());
    f.createNewFile();
    String[] files = new File(System.getProperty("user.dir")).list();
    for(int i=0; i < files.length; i++)
    println(files);
    Output ...
    [[A???C]]
    [[home/ag92114/workspace/test/unicode-test/A???C]]
    Test.java
    Test.java~
    Test.class
    A???C
    As you can see ... the text area correctly displayed the unicode for the String and File objects that I constructed myself, but when I list back the file I just created then my unicode is lost.
    listing the directory on the shell yields ...
    [ag@home:~/workspace/test/unicode-test ] ls
    ./ ../ A???C Test.class Test.java Test.java~
    So possibly the file is not even written to the native filesystem with the unicode??
    Finally I tried opening xemacs and touching a file with a unicode filename and it works fine and displays in the shell just fine, yet when I list the dir contents in java then the unicode is lost. I touched the file [[A?]] using xemacs.
    shell view ...
    [ag@home:~/workspace/test/unicode-test ] ls
    ./ A???C Test.class Test.java~
    ../ [[A?]] Test.java
    java lists files as ...
    Test.java
    Test.java~
    Test.class
    A???C
    A?
    normally this is where I would concede that java just isn't capable of handling unicode in the filesystem, but I know that isn't true because I have tried other applications (jEdit, limewire) that both seem capable of listing and displaying directories and files that contain unicode. i just wish i knew how they were doing it.

  • Java.lang.NoSuchMethodError:java/io/File:

    hi all,
    i have just a dbf file and no database server, can i still use the JDBC driver to make a connnection?
    If yes, i put my dbf file in the Tomcat root directory and write con=DriverManager.getConnection("jdbc:DBF://localhost:8080/","","");
    but it always returns an error
    java.lang.NoSuchMethodError:java/io/File: method getCanonicalFile()Ljava/io/File ; not found
    Anyone know what's wrong?
    Below is the driver readme for the URL format:
    URL format:
    Direct Access:
    jdbc:DBF:[/]/[DatabasePath]
    For example: "jdbc:DBF:/." "jdbc:DBF:/../dbffiles"
    Access by DBF Server: Skip it if you don't use RMI or JINI.
    jdbc:DBF:[/][host][:port]/[DatabasePath]
    Default host:localhost port:2129 DatabasePath:
    For example: "jdbc:DBF://domain.com:3099/../dbffiles" if one DBFServer is run on the 3099 port of domain.com
    */

    We got a similar error the other day trying to grab the Meta-Data.
    Once I took those lines out everything else worked fine. Ie our connection and loading code was fine.
    It seems that not all methods are supported on all implementations of the jdbc/odbc drivers.
    Our current issue has to do with having a lot of different databases, and not wanting to set up ODBC links to all of them (or wanting to find an easy way to do that).

  • Java.io.File exists() problem

    I have a web application deployed on a Windows 2000 server and am running Tomcat 4. I want to check for the existence of an image file before displaying it and am trying to use the java.io.File.exists() method. I am using the following code:
    String strPicUrl = "/images/thefile.jpg"; //Actual value comes from database
    File theFile = new File(application.getRealPath(strPicUrl));
    out.print("File Exists: " + theFile.exists() + "<br>");the actual file name in this example is "/images/theFile.jpg", and theFile.exists() always returns true if the file is there, but differs in case. If I try to display the image it doesnt show up under Tomcat because aliasing is turned off by default. I need to find a way to determine if a file exists based on actual case matching. This way if I get a "true" value, the file should be accessible and/or viewable via the JSP engine.
    Any ideas how to perform a case sensitive "exists()" regardless of the underlying OS file system?

    This looks awesome, but when I tried to implement it without creating a class, I get a method error. Here is the code below:
    String theDir = "C:\\Dir\\Subdir\\";
    FileFilter theFilter = new FileFilter() {
         private String _theFile = null;
         public boolean accept(File file)
              if (file.isDirectory()) return false;
              String fileName = file.getName();
              if (fileName.endsWith(_theFile)) return true;
              return false;
         public void setTheFile(String theFileParam)  
              _theFile = theFileParam;  
    theFilter.setTheFile("theFile.jpg");When I run this I get the following error:
    [javac] ...blah error stuff...
    [javac] cannot resolve symbol
    [javac] symbol : method setTheFile (java.lang.String)
    [javac] location: interface java.io.FileFilter
    [javac] theFilter.setTheFile("theFile.jpg");
    Since I am invoking the FileFilter object directly and not instantiating it in a class, is that causing the error or am I declaring "setTheFile()" wrong?

Maybe you are looking for

  • Access my MacPro (1st gen/ML) with iPhone (Back to My Mac or VPN etc)?

    i had a need the other day to send a file that was stored on my desktop. does anyone know if i can get Back to My Mac working on my iPhone for a first generation mac pro running Mountain Lion or if there is an alternate method to have access to this

  • New 8900 (Sync issue??)

    Just received my shiny new BB 8900 which is looking to be a brilliant piece of kit. Yet I seem to have one issue that I cannot find an answer to anywhere so I thought you lovely people here may have the answer? I have Sync'd my contacts from Windows

  • How to view images in iMessage

    Messages (iMessages), on my MacBook Pro, does not display all images/pictures I receive.  Most are jpg files that I must click on to display.  I would like images to display when I open a chat message. Please assist.

  • Oracle TCA different customer address based on Purpose

    Hello Everyone, We have the following requirement: A customer has a bill-to, ship-to addresses. In addition to that, we need to capture additional information for the purpose 'Install At'. But the information that we need to capture for 'Install At'

  • Moving from Mac to Windows..how to mess things..

    Today i instaled a new laptop with windows 8... Instaled iTunes and since i have near 1Tb of music, all my music files are in a volume in my MacMini , ex : "Music" As coping take to long, i connect my MAC external drive, the volume "Music" to my wind