<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to switch between java.io.File and ivy.scripting.objects.File?</title><link>https://answers.axonivy.com/questions/199/how-to-switch-between-java-io-file-and-ivy-scripting-objects-file</link><description>&lt;p&gt;From the Xpert.ivy help I succeeded in converting a ivy File Object to an Java File Object by using...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;java.io.File tempFile = in.someIvyFileObjectInstance.getJavaFile();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But what about the inverse way: Java File -&amp;gt; Ivy File? I didn't found a solution for this.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/199/how-to-switch-between-java-io-file-and-ivy-scripting-objects-file" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 13 Dec 2013 14:14:01 -0500</lastBuildDate><item><title>Answer by Christian Strebel</title><link>https://answers.axonivy.com/questions/199/how-to-switch-between-java-io-file-and-ivy-scripting-objects-file/204</link><description>&lt;p&gt;The ivy file is always relative addressed (relative to the files folder of the application). See more details on the &lt;a href="http://www.xpertivy.ch/releases/Xpert.ivy/latest/documents/DesignerGuideHtml/ivy.ivyscript.reference.html#ivy.ivyscript.reference.datatypes.file"&gt;Designer Help about ivyScript File&lt;/a&gt;. So normally it makes no sense to generate an ivy file out of a java file if you do not want it to be saved/acessed relatively.&lt;/p&gt;
&lt;p&gt;Possible solution to move a java file into a ivy file: 1. Create IvyFile, then move the java File to the new ivy file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import org.apache.commons.io.FileUtils;

java.io.File javaFile = new java.io.File("/tmp/myFile.txt");
File ivyFile = new File("myFolder/" + javaFile.getName());
FileUtils.moveFile(javaFile, ivyFile.getJavaFile());
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Strebel</dc:creator><pubDate>Fri, 13 Dec 2013 14:14:01 -0500</pubDate><guid>https://answers.axonivy.com/questions/199/how-to-switch-between-java-io-file-and-ivy-scripting-objects-file/204</guid></item></channel></rss>