Skip to main content

Access to file

7 replies [Last post]
deascx
Offline
Joined: 2010-06-07

Hello, all

I am building custom JVM based on Squawk. It is research project and it runs only on PC (no need mobile support). Project need access to local file system (both read and write). The goal is to little modify file access logic. I am newbie to ME and Squawk, please help me.

I tried different approach to write file but didn't succeeded. As i found out svn version doesn't support FileConnection (cause it is optional JSR i suppose). javax.microedition.io.Connector.open("file:///...",) don't work too (seems 'file' protocol not implemented). As I understand InputStream is = getClass().getResourceAsStream("file.txt"); could only helps for reading from deployed bundle so i didn't try it.

As ideal it should be casual java.io.File object (which can redirect calls to underlying HotSpot JVM as i see it).

P.S.
d && d -prod -mac -o2 rom -metadata cldc imp debugger
build ok
d user-suite tests/HelloWorld
fail with

build failed: error invoking public static void com.sun.squawk.Romizer.main(java.lang.String[]) throws java.io.IOException
caused by: java.lang.RuntimeException: java.lang.RuntimeException: javax.microedition.io.ConnectionNotFoundException: //squawk.suite;pathelement=C:\notfiles\sq552:C:\notfiles\sq552\tests\HelloWorldMain
at com.sun.squawk.Romizer.run(Romizer.java:433)
at com.sun.squawk.Romizer.main(Romizer.java:343)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.squawk.builder.Build.java(Build.java:2557)
at com.sun.squawk.builder.JavaCommand.run(JavaCommand.java:71)
at com.sun.squawk.builder.Build$11.run(Build.java:984)
at com.sun.squawk.builder.Build.run(Build.java:1090)
at com.sun.squawk.builder.Build.runCommand(Build.java:1055)
at com.sun.squawk.builder.Build.mainProgrammatic(Build.java:1632)
at com.sun.squawk.builder.Build.main(Build.java:1589)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.squawk.builder.launcher.Launcher.main(Launcher.java:74)
Caused by: java.lang.RuntimeException: javax.microedition.io.ConnectionNotFoundException: //squawk.suite;pathelement=C:\notfiles\sq552:C:\notfiles\sq552\tests\HelloWorldMain
at com.sun.squawk.Romizer.processSuiteArgs(Romizer.java:548)
at com.sun.squawk.Romizer.run(Romizer.java:377)
... 17 more
Caused by: javax.microedition.io.ConnectionNotFoundException: //squawk.suite;pathelement=C:\notfiles\sq552:C:\notfiles\sq552\tests\HelloWorldMain
at com.sun.squawk.io.j2se.file.Protocol.open(Protocol.java:141)
at javax.microedition.io.Connector.openPrim(Connector.java:313)
at javax.microedition.io.Connector.open(Connector.java:236)
at javax.microedition.io.Connector.open(Connector.java:198)
at javax.microedition.io.Connector.openDataInputStream(Connector.java:380)
at com.sun.squawk.ObjectMemoryLoader.load(ObjectMemoryLoader.java:198)
at com.sun.squawk.ObjectGraphLoader.loadSuite(ObjectGraphLoader.java:264)
at com.sun.squawk.Romizer.processSuiteArgs(Romizer.java:546)
... 18 more

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
deascx
Offline
Joined: 2010-06-07

Does squawk-native currently have working file:// protocol implementation (for jvm application) for Windows using VS2010?

C:\...a.net-svn\branches\squawk-native>d 2> log
Launcher: Found tools.jar in C:\java\jdk1.6.0_20\lib\tools.jar, by popping up a
level from jre.
Builder.JDK: Looking for JDK in C:\java\jdk1.6.0_20, popped up a level from jre
Launcher: Found tools.jar in C:\java\jdk1.6.0_20\lib\tools.jar, by popping up a
level from jre.
For vm2c tools.jar=C:\java\jdk1.6.0_20\lib\tools.jar
[Forcing PLATFORM_TYPE to DELEGATING on Windows]
PLATFORM_TYPE=DELEGATING
[running copyphoneme...]
[building cldc-native-declarations...]
[running cldc-native-declarations-gen...]
Skipping generation JNA files in .\cldc-native-declarations
[building cldc...]
[building debugger...]
[building translator...]
[building hosted-support...]
[running squawk.jar...]
[building debugger-proxy...]
[building imp...]
[building javatest-device...]
[building mapper...]
[building romizer...]
[building vm2c...]

vm2c\preprocessed\com\sun\squawk\vm2c\AnnotationParser.java:28: cannot find symbol
symbol : class Tree
location: package com.sun.tools.javac.tree
import com.sun.tools.javac.tree.Tree;
^
vm2c\preprocessed\com\sun\squawk\vm2c\AnnotationParser.java:31: package com.sun.tools.javac.tree.Tree does not exist
import com.sun.tools.javac.tree.Tree.*;
^
vm2c\preprocessed\com\sun\squawk\vm2c\AnnotationParser.java:76: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.AnnotationParser
private void error(Tree tree, String msg) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\AnnotationParser.java:92: package Tree does not exist
public Map parse(Tree.TopLevel unit, Tree node) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\AnnotationParser.java:92: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.AnnotationParser
public Map parse(Tree.TopLevel unit, Tree node) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\AnnotationParser.java:180: package Tree does not exist
public static String getDocComment(Tree.TopLevel unit, Tree node, int margin) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\AnnotationParser.java:180: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.AnnotationParser
public static String getDocComment(Tree.TopLevel unit, Tree node, int margin) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:87: package Tree does not exist
final Tree.MethodDef tree;
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:92: package Tree does not exist
final Tree.TopLevel unit;
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:101: package Tree does not exist
public ProcessedMethod(MethodSymbol method, Tree.MethodDef tree, Tree.TopLevel unit) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:101: package Tree does not exist
public ProcessedMethod(MethodSymbol method, Tree.MethodDef tree, Tree.TopLevel unit) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\InconvertibleNodeException.java:35: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.InconvertibleNodeException
public final Tree node;
^
vm2c\preprocessed\com\sun\squawk\vm2c\InconvertibleNodeException.java:36: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.InconvertibleNodeException
public InconvertibleNodeException(Tree node, String message) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:44: package Tree does not exist
final Tree.Apply call;
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:46: package Tree does not exist
public CallSite(MethodSymbol callee, MethodSymbol caller, Tree.Apply call) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:67: package Tree does not exist
private final Map lineNumberTables = new HashMap();
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:108: package Tree does not exist
public void parse(Iterable units, final Set rootClassNames) throws IOException {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:620: package Tree does not exist
private LineNumberTable lnt(Tree.TopLevel unit) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:749: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.Converter
public String asString(Tree tree, VarSymbol var, boolean lvalue, String object) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:863: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.Converter
public static Symbol getSymbol(Tree tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:43: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.LocalVarDeclScanner
private Map> blockDecls;
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:52: package Tree does not exist
public Map> run(Tree.MethodDef method) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:52: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.LocalVarDeclScanner
public Map> run(Tree.MethodDef method) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:59: package Tree does not exist
public void visitClassDef(Tree.ClassDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:63: package Tree does not exist
public void visitMethodDef(Tree.MethodDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:71: package Tree does not exist
public void visitBlock(Tree.Block tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:77: package Tree does not exist
public void visitVarDef(Tree.VarDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\LocalVarDeclScanner.java:89: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.LocalVarDeclScanner
private void leave(List stats) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Main.java:31: warning: sun.misc.URLClassPath is Sun proprietary API and may be removed in a future release
import sun.misc.URLClassPath;
^
vm2c\preprocessed\com\sun\squawk\vm2c\Main.java:39: cannot find symbol
symbol : class Tree
location: package com.sun.tools.javac.tree
import com.sun.tools.javac.tree.Tree;
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:40: package Tree does not exist
public class MethodConverter extends Tree.Visitor {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:51: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
private final Map> blockLocalDecls;
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:92: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
static void inconvertible(Tree inconvertibleNode, String desc) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:114: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doExpr(Tree tree, int prec, boolean lvalue) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:147: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doExpr(Tree tree, int prec) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:151: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public String exprToString(Tree tree, int prec, boolean lvalue) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:162: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doExpr(Tree tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:168: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doStatement(Tree tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:175: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doExprs(List trees, String sep) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:187: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doExprs(List trees) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:193: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doStatements(List trees, String sep) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:203: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void doBlock(List stats) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:235: package Tree does not exist
public void visitClassDef(Tree.ClassDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:245: package Tree does not exist
public void visitMethodDef(Tree.MethodDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:358: package Tree does not exist
private String makePassThroughInvocation(Tree.MethodDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:378: package Tree does not exist
private void dispatchAbstractMethod(Tree.MethodDef tree, List impls) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:400: package Tree does not exist
public void visitVarDef(Tree.VarDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:419: package Tree does not exist
public void visitSkip(Tree.Skip tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:423: package Tree does not exist
public void visitBlock(Tree.Block tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:431: package Tree does not exist
public void visitDoLoop(Tree.DoLoop tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:446: package Tree does not exist
public void visitWhileLoop(Tree.WhileLoop tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:461: package Tree does not exist
public void visitForLoop(Tree.ForLoop tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:497: package Tree does not exist
public void visitForeachLoop(Tree.ForeachLoop tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:501: package Tree does not exist
public void visitLabelled(Tree.Labelled tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:505: package Tree does not exist
public void visitSwitch(Tree.Switch tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:520: package Tree does not exist
public void visitCase(Tree.Case tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:534: package Tree does not exist
public void visitSynchronized(Tree.Synchronized tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:538: package Tree does not exist
public void visitTry(Tree.Try tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:542: package Tree does not exist
public void visitCatch(Tree.Catch tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:546: package Tree does not exist
public void visitConditional(Tree.Conditional tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:556: package Tree does not exist
public void visitIf(Tree.If tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:581: package Tree does not exist
public void visitExec(Tree.Exec tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:588: package Tree does not exist
public void visitBreak(Tree.Break tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:596: package Tree does not exist
public void visitContinue(Tree.Continue tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:604: package Tree does not exist
public void visitReturn(Tree.Return tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:613: package Tree does not exist
public void visitThrow(Tree.Throw tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:617: package Tree does not exist
public void visitAssert(Tree.Assert tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:621: package Tree does not exist
public void visitApply(Tree.Apply tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:659: package Tree does not exist
public void visitNewClass(Tree.NewClass tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:663: package Tree does not exist
public void visitNewArray(Tree.NewArray tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:667: package Tree does not exist
public void visitParens(Tree.Parens tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:673: package Tree does not exist
public void visitAssign(Tree.Assign tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:758: package Tree does not exist
public void visitAssignop(Tree.Assignop tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:776: package Tree does not exist
public void visitUnary(Tree.Unary tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:794: package Tree does not exist
public void visitBinary(Tree.Binary tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:889: package Tree does not exist
public void visitTypeCast(Tree.TypeCast tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:898: package Tree does not exist
public void visitTypeTest(Tree.TypeTest tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:902: package Tree does not exist
public void visitIndexed(Tree.Indexed tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:936: package Tree does not exist
public void visitSelect(Tree.Select tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:953: package Tree does not exist
public void visitIdent(Tree.Ident tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:968: package Tree does not exist
public void visitLiteral(Tree.Literal tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:997: package Tree does not exist
public void visitTypeIdent(Tree.TypeIdent tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1001: package Tree does not exist
public void visitTypeArray(Tree.TypeArray tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1005: package Tree does not exist
public void visitTypeApply(Tree.TypeApply tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1009: package Tree does not exist
public void visitTypeParameter(Tree.TypeParameter tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1013: package Tree does not exist
public void visitErroneous(Tree.Erroneous tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1017: package Tree does not exist
public void visitLetExpr(Tree.LetExpr tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1021: package Tree does not exist
public void visitModifiers(Tree.Modifiers mods) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1024: package Tree does not exist
public void visitAnnotation(Tree.Annotation tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\MethodConverter.java:1028: cannot find symbol
symbol : class Tree
location: class com.sun.squawk.vm2c.MethodConverter
public void visitTree(Tree tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:75: operator + cannot be applied to int,Tree.Apply.pos
return caller.hashCode() + call.pos;
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:75: incompatible types
found :
required: int
return caller.hashCode() + call.pos;
^
vm2c\preprocessed\com\sun\squawk\vm2c\ProcessedMethod.java:116: cannot find symbol
symbol : method fullName()
location: class com.sun.tools.javac.code.Symbol.ClassSymbol
return sym.enclClass().fullName() + "." + sym;
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:67: package Tree does not exist
private final Map lineNumberTables = new HashMap();
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:112: package Tree does not exist
private Tree.TopLevel unit;
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:115: package Tree does not exist
@Override public void visitTopLevel(Tree.TopLevel tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:122: package Tree does not exist
@Override public void visitMethodDef(Tree.MethodDef tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:158: package Tree does not exist
@Override public void visitApply(Tree.Apply tree) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:170: package Tree does not exist
for (Tree.TopLevel unit: units) {
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:278: cannot find symbol
symbol : method restype()
location: class com.sun.tools.javac.code.Type
String retType = asString(method.type.restype());
^
vm2c\preprocessed\com\sun\squawk\vm2c\Converter.java:308: useSource(javax.tools.JavaFileObject) in com.sun.tools.javac.util.Log cannot be applied to (com.sun.tools.javac.util.Name)
log.useSource(lnt.file);
^
vm2c\preprocessed\com\sun\squawk\vm2c\Main.java:151: warning: sun.misc.URLClassPath is Sun proprietary API and may be removed in a future release
URLClassPath sourcePath = new URLClassPath(URLClassPath.pathToURLs(sourcePathArg));
^
vm2c\preprocessed\com\sun\squawk\vm2c\Main.java:151: warning: sun.misc.URLClassPath is Sun proprietary API and may be removed in a future release
URLClassPath sourcePath = new URLClassPath(URLClassPath.pathToURLs(sourcePathArg));
^
vm2c\preprocessed\com\sun\squawk\vm2c\Main.java:151: warning: sun.misc.URLClassPath is Sun proprietary API and may be removed in a future release
URLClassPath sourcePath = new URLClassPath(URLClassPath.pathToURLs(sourcePathArg));
^
100 errors
4 warnings
Exception while running command vm2c
build failed: javamake compilation failed

derek_white
Offline
Joined: 2006-09-08

On Window, the Squawk-native branch defaults back to using the HotSpot JVM for all IO (delegating mode), because the "native" (JNA-based classes) haven't been implemented yet for non-POSIX platforms. So it really works more like the trunk version.

We don't yet have a system for doing regular builds of various branches in various configurations on all platforms, and in particular we haven't built squawk-native on Windows recently. If it builds it is likely to work fine, because the code is very similar to what is in the trunk.

On the other hand, the trunk version [i]is[/i] built regularly (in a limited number of configurations) on all regular platforms (Windows, Mac, linux, Solaris), as part of the Sun SPOT SDK builds.

So I'd recommend spending just a little time on getting squawk-native to work on Windows, then moving to trunk if it fails.

Now to your actual build failure:
- squawk-native REQUIRES using jdk 1.5 to build.
- trunk REQUIRES using jdk 1.6 to build.

So set JAVA_HOME appropriately.

BTW, Sun had a policy of being very open on what we intended to do, while Oracle would rather not break promises. So we won't be promising to add features or fix bugs, but you'll see updates as they are made.

Message was edited by: derek_white

deascx
Offline
Joined: 2010-06-07

You was right, it is hot spot version problem.

I did find any examples of usage native fs calls (are any somewhere?). So i tried EchoServer:

squawk -suite:tests/TestEcho com.sun.squawk.test.EchoServer
[b]
Uncaught exception in Thread.run():
on thread primitve-thread
java.lang.NullPointerException
at java.lang.Throwable.(bci=16)
at java.lang.Exception.(bci=5)
at java.lang.RuntimeException.(bci=5)
at java.lang.NullPointerException.(bci=5)
in static method #11 of com.sun.squawk.VM(bci=6)
in virtual method #43 of com.sun.squawk.io.j2me.file.Protocol(bci=39)
in virtual method #45 of com.sun.squawk.io.j2me.file.Protocol(bci=20)
at com.sun.squawk.io.j2me.file.Protocol.openInputStream(bci=8)
at com.sun.squawk.io.ConnectionBaseAdapter.openDataInputStream(bci=8)
at javax.microedition.io.Connector.openDataInputStream(bci=38)
in static method #4 of com.sun.squawk.ObjectMemoryLoader(bci=54)
in static method #3 of com.sun.squawk.Suite(bci=16)
in static method #4 of com.sun.squawk.Suite(bci=6)
in virtual method #45 of com.sun.squawk.Isolate(bci=28)
at com.sun.squawk.Isolate.(bci=132)
at com.sun.squawk.JavaApplicationManager.main(bci=117)
in virtual method #95 of com.sun.squawk.Klass(bci=25)
at com.sun.squawk.Isolate.run(bci=411)
at java.lang.Thread.run(bci=17)
in virtual method #47 of com.sun.squawk.VMThread(bci=42)
in static method #3 of com.sun.squawk.VM(bci=6)
=== DEAD-LOCK STATUS: ===
--- isolate 0 "com.sun.squawk.JavaApplicationManager" (EXITED) status ---
Uncaught exception while killing thread - aborting isolate:
on thread primitve-thread
java.lang.RuntimeException: Assertion failed: should not reach here: (VMThread.j
ava:1641): Dead-locked system: no schedulable threads
at java.lang.Throwable.(bci=16)
at java.lang.Throwable.(bci=5)
at java.lang.Exception.(bci=6)
at java.lang.RuntimeException.(bci=6)
in static method #1 of com.sun.squawk.util.Assert(bci=20)
in static method #3 of com.sun.squawk.util.Assert(bci=47)
in static method #9 of com.sun.squawk.util.Assert(bci=8)
in static method #26 of com.sun.squawk.VMThread(bci=130)
in static method #28 of com.sun.squawk.VMThread(bci=18)
in static method #15 of com.sun.squawk.VMThread(bci=31)
in virtual method #63 of com.sun.squawk.Isolate(bci=260)
in virtual method #58 of com.sun.squawk.Isolate(bci=38)
at com.sun.squawk.Isolate.exit(bci=39)
in virtual method #43 of com.sun.squawk.VMThread(bci=90)
in virtual method #47 of com.sun.squawk.VMThread(bci=98)
in static method #3 of com.sun.squawk.VM(bci=6)
=== DEAD-LOCK STATUS: ===
--- isolate 0 "com.sun.squawk.JavaApplicationManager" (EXITED) status ---

caught signal 11
SIGSEGV: Illegal storage access

--------------------------------------------------------------------
GCs: 0 full, 0 partial
** VM stopped: exit code = -1 **
[/b]

I didn't change configuration from native branch. And
PLATFORM_TYPE=DELEGATING
is very suspicious:

d -prod -mac -o2 rom -metadata cldc imp debugger:
[b]

C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-native
>set JAVA_HOME=C:\java\jdk1.5.0_07

C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-native
>set JVMDLL=C:\java\jdk1.5.0_07\jre\bin\client\jvm.dll
Launcher: Found tools.jar in C:\java\jdk1.5.0_07\lib\tools.jar, by popping up a
level from jre.
Builder.JDK: Looking for JDK in C:\java\jdk1.5.0_07, popped up a level from jre
Launcher: Found tools.jar in C:\java\jdk1.5.0_07\lib\tools.jar, by popping up a
level from jre.
For vm2c tools.jar=C:\java\jdk1.5.0_07\lib\tools.jar
[Forcing PLATFORM_TYPE to DELEGATING on Windows]
PLATFORM_TYPE=DELEGATING
[running rom...]
[running romize...]
Loaded suite stripping settings from squawk.library.properties
excluding: com.sun.squawk.compiler.*
excluding: com.sun.squawk.os.*
excluding: com.sun.squawk.BytecodeTracer
excluding: com.sun.squawk.Lisp2Collector*
excluding: com.sun.squawk.CheneyCollector*
excluding: com.sun.squawk.io.j2me.channel.*
excluding: com.sun.squawk.io.j2me.spotsuite.*
excluding: com.sun.cldc.io.connections.HttpConnection
excluding: com.sun.squawk.ClassTunnel
[translating suite squawk [closed: false, parent: null] ...]
C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-native
\vmcore\src\vm\rom.h is already up to date
Romizer processed 655 classes and generated these files:
C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-nati
ve\squawk.sym
C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-nati
ve\squawk.suite
C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-nati
ve\squawk.suite.metadata
C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-nati
ve\squawk_classes.jar
C:\notfiles\MD.data\9.trans2wk\sq\squawk.dev.java.net-svn\branches\squawk-nati
ve\squawk.suite.api
[compiling floating point sources in vmcore\src\vm\fp ...]
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
e_rem_pio2.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
e_sqrt.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
fp_bytecodes.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
k_cos.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
k_rem_pio2.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
k_sin.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
k_tan.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
s_ceil.c
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
s_copysign.c
[/b]

derek_white
Offline
Joined: 2006-09-08

Something is building very strangely in your Windows build. The class com.sun.squawk.io.j2me.file.Protocol should have been excluded on Windows, not com.sun.squawk.io.j2me.channel.Protocol, for instance.

This is a good time to try building the trunk instead.

As fare as file examples go, we don't have neat samples. We use files internally in many places. Look at ObjectMemoryMapper.java or ObjectMemoryFileEndianessConverter.java for example.

derek_white
Offline
Joined: 2006-09-08

This is failing while compiling your application. I'm not sure why. It looks like it can't find the suite "squawk.suite".

The "file:" protocol should work fine. "file://" is a relative path, while "file:///" would be an absolute path.

deascx
Offline
Joined: 2010-06-07

Are samples from tests\ usable or they required additional implementation code?

derek_white
Offline
Joined: 2006-09-08

They should work. I just built from the trunk version to double-check:

> d && d -prod -mac -o2 rom -metadata cldc imp debugger
...

> d user-suite tests/HelloWorld
CompilerOracle: exclude com/sun/squawk/SymbolParser.getSignatureTypeAt
CompilerOracle: exclude com/sun/squawk/SymbolParser.stripMethods
Platform: Mac OS X-i386
[running user-suite...]
[compiling user project at tests/HelloWorld...]
linking user project at tests/HelloWorld
[translating suite tests/HelloWorld/HelloWorld [closed: false, parent: squawk] ...]
Translator properties and current values:
translator.help=false
translator.optimizeConstantObjects=true
translator.deadMethodElimination=true
translator.deleteUnusedPrivateConstructors=true
translator.stats=false
translator.verbose=true
translator.deadStringElimination=true
translator.deadClassElimination=true
[Translator: computing closure....52ms.]
[Translator: whole-suite optimizing and inlining...4ms.]
[Translator: phase2...[Loaded tests.HelloWorld]
9ms.]
[Including resource: META-INF/MANIFEST.MF]
[Adding property key: |MIDlet-Name| value: |HelloWorld|]
[Adding property key: |MIDlet-Version| value: |1.0.0|]
[Adding property key: |MIDlet-Vendor| value: |Sun Microsystems Inc|]
[Adding property key: |MIDlet-1| value: |HelloWorld,, tests.HelloWorld|]
[Adding property key: |MicroEdition-Profile| value: |IMP-1.0|]
[Adding property key: |MicroEdition-Configuration| value: |CLDC-1.1|]
[loaded object memory from 'file://tests/HelloWorld/HelloWorld.suite']
Romizer processed 1 classes and generated these files:
/Users/dw29446/squawk/cleansquawk/tests/HelloWorld/HelloWorld.sym
/Users/dw29446/squawk/cleansquawk/tests/HelloWorld/HelloWorld.suite
/Users/dw29446/squawk/cleansquawk/tests/HelloWorld/HelloWorld.suite.metadata
/Users/dw29446/squawk/cleansquawk/tests/HelloWorld/HelloWorld.suite.api
Total time: 1s

> squawk -suite:tests/HelloWorld/HelloWorld
Hello world (from a MIDlet)

--------------------------------------------------------------------
Hits - Class:91.25% Monitor:68.54% Exit:100.00% New:94.23%
GCs: 1 full, 0 partial
** VM stopped: exit code = 0 **