--
You received this message because you are subscribed to the Google Groups "j2objc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to j2objc-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import java.io.*;//Java program demonstrating FileInputStream class ReadFile{ public static void main(String args[]) throws IOException { //attach the file to FileInputStream FileInputStream fin= new FileInputStream("file1.txt"); //illustrating getChannel() method System.out.println(fin.getChannel()); //illustrating getFD() method System.out.println(fin.getFD()); //illustrating available method System.out.println("Number of remaining bytes:"+fin.available()); //illustrating skip method /*Original File content: * This is my first line * This is my second line*/ fin.skip(4); System.out.println("FileContents :"); //read characters from FileInputStream and write them int ch; while((ch=fin.read())!=-1) System.out.print((char)ch); //close the file fin.close(); }}
I compile it using javac and then I run ./j2objc -sourcepath x -classpath x -d x ReadFile.java
Then I use ./j2objcc ReadFile.m -ljre_emul
And then I try ./a.out ReadFile and that's where it fails
For errors I get :
Exception in thread "main" com.google.j2objc.LibraryNotLinkedError: Channel support is unavailable.
It then asks me to fix it either by adding -ljre_channels if I was using -ObjC or call JavaNioChannelFactoryImpl_class_()
Thank you in advance for your help.
...
JavaIoInputStream *EuMyrpgPlayerandroidResources_getAssetsWithNSString_(NSString *filename) {
EuMyrpgPlayerandroidResources_initialize();
JavaIoInputStream *is = nil;
is = [JavaIoInputStream_class_() getResourceAsStream:filename];
return is;
}
I have included the file in the copy file part, I don't really know what to put in the subpath field, I reckon there should be nothing since the parameter filename contains "assets/config_RA_FR.xml"
I have also tried with "assets" and "assets/" in the subpath field but the function still returns nil
I feel I didn't understand what to put before the getResourceAsStream, in the java code I wrote :
package eu.myrpg.playerandroid;
import java.io.InputStream;
public class Resources {
public static InputStream getAssets(String filename) {
InputStream is = null;
is = InputStream.class.getResourceAsStream(filename);
return is;
}
}
Then I call this getAssets function when I need inputstream
<blockquote style="margin:0;margin-left:0.8ex;border-left:1