Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    a duplicate file name exists, or the file cannot be found

    class ThreadCan implements Runnable {
    TempReader app = new TempReader();
    public void run(){
    // TODO Auto-generated method stub
    if (app.init()){
    System.out.println("Wait for read temperature from CAN");
    app.readTempViaCAN();
    }//if (app.init());
    }
    }

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    That screenshot is far to small; there is no way to read what is on there. Redirect the output to a file and post that instead.
    I cannot see anything you are doing here that will cause the above error. You are not directly interacting with a filesystem. If the .readTempViaCAN is what is throwing the error, then you need to point it at something. I would expect that if this is the case though, that the method should contain no overload that allows nothing, so the code should fail to compile. You may be missing something else, such as an app.open type call to force open a resource manually.

  • Users who have thanked Fou-Lu for this post:

    mazao (12-17-2011)

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts
    click on screenshot to full

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Quote Originally Posted by mazao View Post
    click on screenshot to full
    The screenshot is a thumbnail. There is no option to increase its size as its already full. Post the output to a file.

  • #5
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts
    my code :

    /* Create on: 16 July 2008 13:00:00
    **/
    class ThreadCan implements Runnable {
    TempReader app = new TempReader();
    public void run(){
    // TODO Auto-generated method stub
    if (app.init()){
    System.out.println("Wait for read temperature from CAN");
    app.readTempViaCAN();
    }//if (app.init());
    }
    }


    compile error :

    ThreadCan.java:4:cannot resolve symbol
    symbol: class TempReader
    location : class ThreadCan
    TempReader app = new TempReader();
    ^

    ThreadCan.java:4:cannot resolve symbol
    symbol: class TempReader
    location : class ThreadCan
    TempReader app = new TempReader();
    ^

    2 errors
    A duplicate file name exists, or the file
    cannot be found.

    I have 5 files can only pass compile 1 file other have same error problem
    sourcecode
    http://www.mediafire.com/?eujeu6vg6hcbxl3

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    The problem is really simple, TempReader cannot be resolved. Make sure that you are compiling with the classpath added to include a location to resolve your imports to. TempReader has to be compiled first as well.

    This tutorial is excellent for helping you set up a manual javac call: http://docs.oracle.com/javase/1.4.2/...ows/javac.html
    Alternatively (and my recommendation), use an IDE with a builtin precompile before run. Eclipse is what I use, although any IDE designed for java will have this functionality built in.

  • Users who have thanked Fou-Lu for this post:

    mazao (12-17-2011)

  • #7
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts
    emm I don't know how to add classpath to include a location to resolve.
    I use build.bat compile, code
    -----------------------------------------------------------------------------------
    @echo off
    REM Source files
    set SRC= ThreadCan.java

    mkdir output
    C:\j2sdk1.4.2\bin\javac.exe -target 1.1 -bootclasspath C:\snap\classes -classpath . -d .\output %SRC%
    C:\snap\bin\preverify -classpath C:\snap\classes -nofinalize -d output output
    move output\*.class .
    rmdir /s /q output

    pause
    ------------------------------------------------------------------------
    I have file TempReader.java that can pass compile get to TempReader.class
    but my ThreadCan.java can't pass compile

    I'm confused that I must include classpath or I must set add variable
    because my code build.bat that have C:\snap\bin\preverify -classpath C:\snap\classes
    about classpath

    Can I download more classpath ?????

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Is ThreadCan and TempReader a part of the same package? If they are not, classpath has to include the path to TempReader's package level (the import will take care of the drill into the package). If they are the same package, and that package is default, a classpath of /path/to/.class/files/package should work just fine.
    This is pretty old school too. You're compiling for a 1.1 version of Java. Java is currently at Java 7, so there is a high probability on more complex programs it will fail to compile since there will be many methods not available. Just ignore the target and let the version of javac determine what is best to compile for.

  • Users who have thanked Fou-Lu for this post:

    mazao (12-18-2011)

  • #9
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts
    now I try to use jdk1.7.0_02 compile TempReader.java that can pass compile on j2sdk1.4.2
    but jdk1.7.0_02 can't pass compile

    error compile :
    TempReader.java:28:error:cannot access StringBuilder

    System.out.println("Receive Event."); System.out.println("Frame received:"); System.out.print("ID: "+Integer.toHexString(cf.ID)); if (cf.extendedID) System.out.print("(extenedID)");
    ^

    class file for java.lang.StringBuilder not found
    A a duplicate file name exists, or the file cannot be found
    ----------------------------------------------------------------------------------

    but work on j2sdk1.4.2 Why ?

  • #10
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Are you sure you have your versions right? 1.4 won't compile a StringBuilder since it wasn't added until java 1.5. Methinks that error is complaining on a javac 1.4, not the 1.7.

  • Users who have thanked Fou-Lu for this post:

    mazao (12-18-2011)

  • #11
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts
    now I use 1.4 that can pass compile TempReader.java work done get TempReader.class

    but you told me try to use 1.7 that can't pass compile have error:cannot access StringBuilder

    error java1.7

    I think i must use java1.4 and find solve error because work on TempReader.java

    compile error :

    ThreadCan.java:4:cannot resolve symbol
    symbol: class TempReader
    location : class ThreadCan
    TempReader app = new TempReader();
    ^

    ThreadCan.java:4:cannot resolve symbol
    symbol: class TempReader
    location : class ThreadCan
    TempReader app = new TempReader();
    ^

    2 errors
    A duplicate file name exists, or the file
    cannot be found.

  • #12
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    No, what I'm saying is that stringbuilder will not compile in 1.4. The class does not exist until 1.5, so that tells me your versions of javac are backwards.
    So lets go back to square one. First and foremost, is ever required class imported? Is TempReader in a different package and provided the proper import?

  • Users who have thanked Fou-Lu for this post:

    mazao (12-19-2011)

  • #13
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thank a lot


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •