How come File.separator doesn't work for URLClassLoader as a directory?

I set as a URLClassLoader URL something like:
File f = new File("xxx.jar");
URL url = new URL("file","",f.getCanonicalPath() + File.separator);
URLClassLoader urlc = new URLClassLoader(new URL[]url,getClass().getClassLoader());
The problem is, the "platform independent" File.separator does NOT seem to be used by URLClassLoader in the Windows env where \ is the separator. The URLClassLoader says anything that ends with / is a dir, otherwise its treated as a .jar file. Is this a possible bug with URLClassLoader in that it should recongize the File.separator as the end character for a directory? I think it should. Seems to me / is unix/linux, and \ is windows. So if I am running on windows, for URLClassLoader to see a directory, I end up with something like c:\path/ which seems odd.

Didn't even think about that. Does file.toURL() return the full canonical path? I'll give it a try though, thanks.

Similar Messages

  • File.setLastModified doesn't work for files with another owner and 777 perm

    import java.io.File;
    public class Main {
        public static void main(String[] args) {
            File file = new File(args[0]);
            System.out.println("exec:" + file.canExecute());
            System.out.println("read:" + file.canRead());
            System.out.println("write:" + file.canWrite());
          System.out.println(file.setLastModified(System.currentTimeMillis()));
    } Compile it to ~. In ~ create file aaa.txt. Next
    ~ $ sudo chown root:root aaa.txt
    ~ $ sudo chmod 777 aaa.txt Checking
    ~ $ ls -la aaa.txt
    -rwxrwxrwx 1 root root 472 2009-11-24 12:09 aaa.txt Running application
    ~ $ java -Djava.security.debug=all Main /home/jfreem/aaa.txt
    scl:  getPermissions ProtectionDomain  (file:/home/jfreem/ <no signer certificates>)
    sun.misc.Launcher$AppClassLoader@1c78e57
    <no principals>
    java.security.Permissions@1186fab (
    (java.lang.RuntimePermission exitVM)
    (java.io.FilePermission /home/jfreem/- read)
    scl:
    exec:true
    read:true
    write:true
    false setLastModified return false and modification time of file remain the same. Why?

    Can you see if the file is getting to the webserver's (not
    ColdFusion)
    temp file directory?
    When a file is uploaded from the browser the
    webserver(IIS|Apache|etc)
    upload it to a temp location, then all CFFile does is copy
    the file
    from the temp directory to where ever specified.
    So you can see if the problem is failing before or after this
    point.
    Grant wrote:
    >
    >
    > We are migrating our intranet from ColdFusion 5 on
    Solaris to ColdFusion MX 7
    > on Linux and I'm testing out the existing applications
    on the new server. The
    > processing page for a file upload is using CFFILE with
    ACTION="upload". The
    > page finishes processing fine, no error, and continues
    as if it was successful
    > but the file never actually gets to the destination
    directory. I tried with
    > larger files and it did take longer (so the file
    appeared to get transmitted),
    > but it still does not get saved to the server's file
    system. This all works
    > fine on the current system running CF5. I've tried the
    CFFILE destination with
    > and without a slash at the end - no difference. We have
    ColdFusion 7.0.1
    > installed. Hot fix 2 has been applied but that did not
    fix the problem.
    >
    > Any ideas?
    >

  • How come file sync isn't working?

    Why can I not sync files?

    Hi tschloss,
    Welcome to Adobe Forum,
    Please click on the link: https://creative.adobe.com/#earlyaccess/ and apply for early access.
    It will provide the accessibility to sync files.
    Regards,
    Rajshree

  • How come forms central doesn't work with my iPhone?

    Forms Central works great from a PC, but when I try and load the sign in page using my iPhone, it tries to load a page, gets half way, then a new web address comes up, tries to load that page, and goes back and fourt and is stuck in a loop. What's happening?

    I am having this same issue.

  • How come Power Nap doesn't work on late 2011 MacBook Pros?

    I have a late MacBook Pro, recently bought Mountian Lion hoping I would get Power Nap, but unfortunatly not, could someone be able to explain why Power Nap is only for MacBook Pro Retina and MacBook Air please?
    Much appreciated.

    Because they have the 'official' Apple flash storage. Other flash storage devices on stock 2011 MBPs - such as SSDs - don't have the necessary firmware that Apple-sanctioned flash storage devices have.
    It was a bummer for me, too. I've a SSD and was hoping to use Power Nap on my late 2011. But I have a Crucial m4, not an Apple device.
    Clinton

  • How come this formula doesn't work :ARRONDI((Total Total des factures÷1.149749) ; 2) ???

    I need some help to understand basic formula please...

    I am guessing you mean this formula?
    ARRONDI((Total Total des factures÷1.149749) ; 2)
    since you are using the semicolon (";") as the argument delimiter you should be using the comma as the decimal.
    so try this:
    ARRONDI((Total Total des factures÷1,149749) ; 2)

  • How do you save data into an excel file while myRIO is acquiring data? I tried saving it using "Write to file" but it doesn't work for some reason.

    I am acquiring cosine wave and a pulse wave as input and I want to store their peak to peak values into an excel file. "Write to File" is not working for it. Is there any other vi which can be used for data logging?
    Thank you for your help.

    Hi Ssheoran,
    Can you provide more detail when you say that the Write to File VI doesn't work? Is there an error given? Or can you just not find the file on your computer? Keep in mind using this file in a Real-Time VI on the myRIO will save files on the myRIO. You will then have to transfer to your PC. Please view the following video as a guide for saving files and transferring them to your computer: (http://www.youtube.com/watch?v=BuREWnD6Eno). Hope this helps.
    Best Regards,
    Roel F.
    Applications Engineer
    National Instruments

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • The wifi at my school isn't very good. And I can't send iMessages through it. It works for some apps like score center and my radar app, but doesn't work for other apps like clash of clans and iMessage. How can I get it to work on that  wifi network

    The wifi at my school isn't very good. And I can't send iMessages through it. It works for some apps like score center and my radar app, but doesn't work for other apps like clash of clans and iMessage. How can I get it to work on my school wifi. I have an iPhone 4S on AT&T and iOS 7.04

    In a roaming network, your "main" router is the device that would require port mapping/forwarding to be configured in order to access the IP camera from the Internet. This router is also the one that would be provide the private IP address for the camera which you will want to be a static one.
    So as you described your network, the IP cameras should be getting an IP address or you assigned it a static one and this is the address that you would enter in the Private IP address (or equivalent depending on the router used) field when setting up port mapping.
    If you are not able to access this camera from the local network, then this should be troubleshot first.

  • How can I upload a video from my PC through I tunes to camera roll on my iPhone? Is there an app or format of specific video supported? Sync from photos include video doesn't work for me.

    How can I upload a video from my PC through I tunes to camera roll on my iPhone? Is there an app or format of specific video supported? Sync from photos include video doesn't work for me.

    download the new you tube apps in i tunes, in os6 just pick a video in the photos apps and select share, the old you tube app icon will appear

  • Hello, can anyone tell me how to share my home macbook pro to my imac in the office? I tried file sharing but never worked for me...appreciate if anyone can help!

    Hello, can anyone tell me how to share my home macbook pro to my imac in the office? I tried file sharing but never worked for me...appreciate if anyone can help!

    I should have added to my posting (instead of using this "reply" -  it is the server passwork it is asking for and I have never known that I had one and assumed it was the passwork I always used for this type of thing.

  • I've bought an app called WhatsApp but I was not told that app doesn't work for ipod. So I would like to know how to turn back and get my money back.

    I've bought an app called WhatsApp but I was not told that app doesn't work for ipod. So I would like to know how to turn back and get my money back.

    Did you fail to look at the requirements before purchasing?
    All sales are final.  You can try contacting itunes support and asking for an exception

  • How do I uninstall Firefox 4 & get previous version back? The new upgrade has problems & doesn't work for me.

    How do I uninstall Firefox 4 and get the previous version back?
    The upgrade has many problems and doesn't work for me.

    new version is the worst Firefox ever, no lip.

  • When i convert a word file with a hyperlinks to a PDF file it doesn't work ?? thanks in advance for helping me

    when i convert a word file with a hyperlinks to a PDF file it doesn't work ?? thanks in advance for helping me

    using microsoft word.
    the hyperlink doesn't work in the pdf file (adobe reader).
    adobe reader xi.
    my operating system windows 8.1.
    the attached screen is appeared.

  • HT4527 How on earth do you get Home Sharing to work properly?  We have tried multiple times and it simply doesn't work for us!

    How on earth do you get Home SHaring to work?  We have tried numerous times and it simply doesn't work for us!

    Turn it on.
    Honestly, if you want help it is generally a good idea to ask a specific question and give some details of what problem is occurring.
    If trying to move media, using home sharing is simply a bad idea.  Follow some of the other instructions in the article from which the question was posted to move media.

Maybe you are looking for