From 6099ea8c41222412d95fee5fcb4c51f2020a19f1 Mon Sep 17 00:00:00 2001 From: messi18 Date: Fri, 2 Nov 2012 01:55:05 +0800 Subject: [PATCH 1/2] open a file in binary mode to save byte codes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I try to compile a bs file(helloworld.bs for example) first and run it with command:   java helloworld I get an error: Exception in thread "main" java.lang.ClassFormatError: .... Just as the issue: https://github.com/headius/bitescript/issues/9 I opened this file, found generated byte array was saved to a file opened not in binary mode. This will cause EOL <-> CRLF conversion on Windows. So I fix it. --- bin/bitec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/bitec b/bin/bitec index b8c6fef..7ad5429 100755 --- a/bin/bitec +++ b/bin/bitec @@ -18,5 +18,5 @@ end fb.generate do |filename, classbuilder| bytes = classbuilder.generate - File.open(filename, 'w') {|f| f.write(bytes)} + File.open(filename, 'wr') {|f| f.write(bytes)} end From 10ff7f9102bbedc4eb24cba28164f53c74f293ca Mon Sep 17 00:00:00 2001 From: messi18 Date: Fri, 2 Nov 2012 02:12:29 +0800 Subject: [PATCH 2/2] Update README.txt --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index e121928..7eb726c 100644 --- a/README.txt +++ b/README.txt @@ -30,7 +30,7 @@ fb = FileBuilder.build(__FILE__) do end fb.generate do |filename, class_builder| - File.open(filename, 'w') do |file| + File.open(filename, 'wb') do |file| file.write(class_builder.generate) end end