# File and URL for Better Java Mobile Compatibility

DevFeed: [File and URL for Better Java Mobile Compatibility](<https://devfeed.tech/articles/file-and-url-for-better-java-mobile-compatibility-19301.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/file-url-java-mobile-compatibility/>)

Author: Shai Almog

Published: 2016-10-19T00:00:00Z

Content type: article

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [API](<https://devfeed.tech/topics/api.md>), [IO](<https://devfeed.tech/topics/io.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [compatibility](<https://devfeed.tech/tags/compatibility.md>), [io](<https://devfeed.tech/tags/io.md>), [java](<https://devfeed.tech/tags/java.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [porting](<https://devfeed.tech/tags/porting.md>)

## AI overview

The article introduces com.codename1.io.File and com.codename1.io.URL as drop-in replacements for java.io.File and java.net.URL to improve the portability of existing Java code to Codename One. It notes compatibility limitations, including counterintuitive API mappings and possible EDT blocking when using the synchronous API.

## Source excerpt

I explained why we don't support the full Java API (and the difficulties involved) not so long ago. The logic behind this is solid. However, the utility of porting existing Java code to Codename One is also with a lot of merit. We try to strike a balance between portability, compatibility to the Java API etc. and that is a very delicate balance. To improve the situation we created two new classes: com.codename1.io.File & com.codename1.io.URL. They are meant to be drop-in replacements for java.io.File & java.net.URL to help you port existing code.