{"id":7206,"date":"2012-09-19T10:03:23","date_gmt":"2012-09-19T01:03:23","guid":{"rendered":"http:\/\/fukata.org\/?p=7206"},"modified":"2017-08-11T22:58:47","modified_gmt":"2017-08-11T22:58:47","slug":"j2objc-hello-world","status":"publish","type":"post","link":"https:\/\/blog.fukata.org\/archives\/7206\/","title":{"rendered":"[\u30e1\u30e2]j2objc\u3067Hello World\u3084\u3063\u3066\u307f\u305f"},"content":{"rendered":"

Google\u304cJava\u30b3\u30fc\u30c9\u304b\u3089Objective-C\u30b3\u30fc\u30c9\u306b\u5909\u63db\u3059\u308b\u30c4\u30fc\u30eb\u3092\u516c\u958b\u3057\u305f\u306e\u3067\u65e9\u901f\u89e6\u3063\u3066\u307f\u305f\u3002<\/p>\n

xcode\u3092\u4f7f\u308f\u305a\u306b\u3068\u308a\u3042\u3048\u305a\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u5b9f\u884c\u3057\u3066\u307f\u308b\u3002<\/p>\n

<\/p>\n

\u30bd\u30fc\u30b9\u306f\u4e0b\u8a18\u304b\u3089\u843d\u3068\u3057\u3001make\u3059\u308c\u3070build_result\u306bj2objc\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u6765\u4e0a\u304c\u3063\u3066\u3044\u308b\u3068\u601d\u3046\u3002<\/p>\n

j2objc – A Java to iOS Objective-C translation tool and runtime. – Google Project Hosting<\/a><\/p>\n

\r\ngit clone https:\/\/code.google.com\/p\/j2objc\/\r\ncd j2objc\r\nmake\r\n<\/pre>\n
\r\npackage org.fukata.j2objc;\r\n\r\nclass Hoge {\r\n    public static void main(String[] args) {\r\n        System.out.println(\"Hello j2objc\");\r\n    }   \r\n}\r\n<\/pre>\n

\u5b9f\u969b\u306b\u5909\u63db\u3057\u3066\u307f\u308b<\/p>\n

\r\n~\/usr\/local\/bin\/j2objc \\\r\n-classpath \/Library\/Java\/JavaVirtualMachines\/1.7.0.jdk\/Contents\/Home\/jre\/lib\/rt.jar \\\r\n-d .\/result\/ .\/src\/org\/fukata\/j2objc\/Hoge.java\r\n<\/pre>\n

\u3059\u308b\u3068\u3001result\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u308b\u306f\u305a\u3002<\/p>\n

\r\nresult\r\n\u2514\u2500\u2500 org\r\n    \u2514\u2500\u2500 fukata\r\n        \u2514\u2500\u2500 j2objc\r\n            \u251c\u2500\u2500 Hoge.h\r\n            \u2514\u2500\u2500 Hoge.m\r\n<\/pre>\n

Hoge.h<\/h2>\n
\r\n\/\/\r\n\/\/  Generated by the J2ObjC translator.  DO NOT EDIT!\r\n\/\/  source: .\/src\/org\/fukata\/j2objc\/Hoge.java\r\n\/\/\r\n\/\/  Created by tatsuya on 9\/19\/12.\r\n\/\/\r\n\r\n@class IOSObjectArray;\r\n\r\n#import \"JreEmulation.h\"\r\n\r\n@interface OrgFukataJ2objcHoge : NSObject {\r\n}\r\n\r\n@end\r\n<\/pre>\n

Hoge.m<\/h2>\n
\r\n\/\/\r\n\/\/  Generated by the J2ObjC translator.  DO NOT EDIT!\r\n\/\/  source: .\/src\/org\/fukata\/j2objc\/Hoge.java\r\n\/\/\r\n\/\/  Created by tatsuya on 9\/19\/12.\r\n\/\/\r\n\r\n#import \"IOSObjectArray.h\"\r\n#import \"org\/fukata\/j2objc\/Hoge.h\"\r\n\r\n@implementation OrgFukataJ2objcHoge\r\n\r\n@end\r\n\r\n\r\nint main( int argc, const char *argv[] ) { \r\n  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];\r\n  IOSObjectArray *args = JreEmulationMainArguments(argc, argv);\r\n\r\n  NSLog(@\"%@\", @\"Hello j2objc\");\r\n  int exitCode = 0;\r\n\r\n  [pool release];\r\n  return exitCode;\r\n}\r\n<\/pre>\n

\u65e2\u5b58\u306ejava\u30b3\u30fc\u30c9\u306b\u5bfe\u3057\u3066\u3082\u4f55\u304b\u304b\u3051\u3066\u307f\u305f\u304f\u306a\u308b\u3002<\/p>\n

\u6c4e\u7528\u6027\u306e\u9ad8\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3001\u30b3\u30fc\u30c9\u3092Android\u3001iOS\u30a2\u30d7\u30ea\u3067\u4f7f\u3044\u307e\u308f\u3059\u6642\u306b\u4fbf\u5229\u306a\u306e\u304b\u3082\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Google\u304cJava\u30b3\u30fc\u30c9\u304b\u3089Objective-C\u30b3\u30fc\u30c9\u306b\u5909\u63db\u3059\u308b\u30c4\u30fc\u30eb\u3092\u516c\u958b\u3057\u305f\u306e\u3067\u65e9\u901f\u89e6\u3063\u3066\u307f\u305f\u3002 xcode\u3092\u4f7f\u308f\u305a\u306b\u3068\u308a\u3042\u3048\u305a\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u5b9f\u884c\u3057\u3066\u307f\u308b\u3002 … \u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":9223372036854775807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1980],"tags":[994],"_links":{"self":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/7206"}],"collection":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/comments?post=7206"}],"version-history":[{"count":0,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/7206\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media\/9223372036854775807"}],"wp:attachment":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media?parent=7206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/categories?post=7206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/tags?post=7206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}