Tried now to create MusicPlayer.java:
package data.scripts.world;
import sun.audio.*;
import java.io.*;
public class MusicPlayer {
private String filename;
public MusicPlayer(String filename) {
this.filename = filename;
}
public void play() {
try {
InputStream in = new FileInputStream(filename);
AudioStream as = new AudioStream(in);
AudioPlayer.player.start(as);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Got this error:
17665 [Thread-6] ERROR com.fs.starfarer.combat.String - java.lang.RuntimeException: Error compiling [data.scripts.world.MusicPlayer]
java.lang.RuntimeException: Error compiling [data.scripts.world.MusicPlayer]
at com.fs.starfarer.loading.scripts.ScriptStore$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.SecurityException: File access and reflection are not allowed to scripts.
at com.fs.starfarer.loading.scripts.B.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:83)
at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:158)
at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:124)
at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java:8729)
at org.codehaus.janino.UnitCompiler.importTypeOnDemand(UnitCompiler.java:7616)
at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4574)
at org.codehaus.janino.UnitCompiler.access$10300(UnitCompiler.java:104)
at org.codehaus.janino.UnitCompiler$17.visitReferenceType(UnitCompiler.java:4442)
at org.codehaus.janino.Java$ReferenceType.accept(Java.java:2020)
at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4476)
at org.codehaus.janino.UnitCompiler.getLocalVariable(UnitCompiler.java:1607)
at org.codehaus.janino.UnitCompiler.buildLocalVariableMap(UnitCompiler.java:2226)
at org.codehaus.janino.UnitCompiler.access$3700(UnitCompiler.java:104)
at org.codehaus.janino.UnitCompiler$7.visitLocalVariableDeclarationStatement(UnitCompiler.java:2141)
at org.codehaus.janino.Java$LocalVariableDeclarationStatement.accept(Java.java:1771)
at org.codehaus.janino.UnitCompiler.buildLocalVariableMap(UnitCompiler.java:2144)
at org.codehaus.janino.UnitCompiler.buildLocalVariableMap(UnitCompiler.java:2158)
at org.codehaus.janino.UnitCompiler.access$2700(UnitCompiler.java:104)
at org.codehaus.janino.UnitCompiler$7.visitBlock(UnitCompiler.java:2129)
at org.codehaus.janino.Java$Block.accept(Java.java:1395)
at org.codehaus.janino.UnitCompiler.buildLocalVariableMap(UnitCompiler.java:2144)
at org.codehaus.janino.UnitCompiler.buildLocalVariableMap(UnitCompiler.java:2200)
at org.codehaus.janino.UnitCompiler.access$3400(UnitCompiler.java:104)
at org.codehaus.janino.UnitCompiler$7.visitTryStatement(UnitCompiler.java:2136)
at org.codehaus.janino.Java$TryStatement.accept(Java.java:1592)
at org.codehaus.janino.UnitCompiler.buildLocalVariableMap(UnitCompiler.java:2144)
at org.codehaus.janino.UnitCompiler.buildLocalVariableMap(UnitCompiler.java:2105)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1946)
at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:789)
at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:770)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:464)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:357)
at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:312)
at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:770)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:319)
at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:288)
at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:203)
at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 2 more
23616 [Thread-6] INFO com.fs.profiler.Profiler - ID Calls Duration Percent
23617 [Thread-6] INFO com.fs.profiler.Profiler - --------------------------------
Tried to use audio file that completely converted to class (Jawa.java - you can download it)...
Got same error:
17267 [Thread-6] ERROR com.fs.starfarer.combat.String - java.lang.RuntimeException: Error compiling [data.scripts.world.Jawa]
java.lang.RuntimeException: Error compiling [data.scripts.world.Jawa]
at com.fs.starfarer.loading.scripts.ScriptStore$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.SecurityException: File access and reflection are not allowed to scripts.
at com.fs.starfarer.loading.scripts.B.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:83)
at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:158)
at org.codehaus.janino.ReflectionIClass.classToIClass(ReflectionIClass.java:305)
at org.codehaus.janino.ReflectionIClass.classesToIClasses(ReflectionIClass.java:320)
at org.codehaus.janino.ReflectionIClass.getInterfaces2(ReflectionIClass.java:116)
at org.codehaus.janino.IClass.getInterfaces(IClass.java:361)
at org.codehaus.janino.UnitCompiler.getIMethods(UnitCompiler.java:6637)
at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:6575)
at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:6488)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3429)
at org.codehaus.janino.UnitCompiler.access$6300(UnitCompiler.java:104)
at org.codehaus.janino.UnitCompiler$11.visitMethodInvocation(UnitCompiler.java:2869)
at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2890)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:3897)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1637)
at org.codehaus.janino.UnitCompiler.access$1700(UnitCompiler.java:104)
at org.codehaus.janino.UnitCompiler$5.visitReturnStatement(UnitCompiler.java:877)
at org.codehaus.janino.Java$ReturnStatement.accept(Java.java:1803)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:888)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1740)
at org.codehaus.janino.UnitCompiler.access$1200(UnitCompiler.java:104)
at org.codehaus.janino.UnitCompiler$5.visitTryStatement(UnitCompiler.java:872)
at org.codehaus.janino.Java$TryStatement.accept(Java.java:1592)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:888)
at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:914)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1999)
at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:789)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:493)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:357)
at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:312)
at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:770)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:319)
at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:288)
at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:203)
at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 2 more
19657 [Thread-6] INFO com.fs.profiler.Profiler - ID Calls Duration Percent
19657 [Thread-6] INFO com.fs.profiler.Profiler - --------------------------------
[attachment deleted by admin]