j2objc for windows apps?

159 views
Skip to first unread message

vkalma...@gmail.com

unread,
Nov 16, 2015, 6:40:50 PM11/16/15
to j2objc-discuss
Hi Thanks for creating this tool. We tried some prototype and it works perfect for ios and android.
As a company we want to create the desktop(PC) app as well and we want to leverage this to windows apps as well. Is there any way we can do this? In th blog I read something about CFRONT?

Thanks,
Veeresh

Tom Ball

unread,
Nov 16, 2015, 6:58:44 PM11/16/15
to j2objc-discuss
We have no plans on supporting Windows -- j2objc is focused on iOS, and that's keeping us busy! You might have better luck using Xamarin, which uses C# as its source language and supports Windows, Mac, Android and iOS.

cfront was the first C++ compiler (back in the late 80s), and is no longer in use. I brought it up only because of its strategy: it transpiled C++ to C, then invoked the C compiler. When it first came out, developers wanted to see the C output (which was harder to read than j2objc's), then later they rarely checked it and just used the .o output, until finally C++ compiler stopped generating C and went directly to .o files. We'd like to follow the same approach.

--
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.

Bruno

unread,
Nov 16, 2015, 7:08:31 PM11/16/15
to j2objc-discuss
With the approach of supporting object files, has any thought been given to supporting headers in both Objective-C and Swift?

Keith Stanger

unread,
Nov 17, 2015, 9:38:47 AM11/17/15
to j2objc-discuss
It's worth mentioning that one option for supporting Windows (and other platforms) is to build a web version of your app by translating your Java source to JavaScript using Google Web Toolkit.

Kirk Vogen

unread,
Nov 17, 2015, 12:16:33 PM11/17/15
to j2objc-discuss
There is a tool called JUniversal that translates Java to C#. It is open source and came out of Microsoft. It appears to be in the same spirit of J2ObjC, except for C#. It looks like it's Java API emulation isn't as advanced as J2ObjC's, though. That's about I'll I know, but might be worth checking it out.

hawk...@gmail.com

unread,
Jan 20, 2016, 10:16:03 AM1/20/16
to j2objc-discuss, vkalma...@gmail.com

We have a requirement to produce native code that doesn't use a JVM for our windows 10 app, and we really love the way we've set up our java code leveraging maven dependencies.

We are soon going to be doing a PoC where we use https://github.com/Microsoft/WinObjC to translate NSSDK calls to windows ones. It's pretty goofy as a stack, but it should be perfectly feasable.

Java
=> transpiled with J2ObjC produces Objective-C + emulated JRE libs
=> compiled and linked with WinObjC produces a static library
=> link static library to app or dll with unused symbols optimized out.

#thedream

Lil Bil

unread,
Sep 14, 2022, 7:29:05 PM9/14/22
to j2objc-discuss
It's been >6 years since last activity on this thread, so wondering has there been any new thoughts on supporting Windows?

Unfortunately, the aforementioned options in this discussion are inactive/dead (JUniversal, WinObjC),  and the only other option that seems viable is using GNUstep (instead of WinObjC) but that requires a lot of shimming needed b/t the j2objc-translated code and GNUstep.

Tom Ball

unread,
Sep 15, 2022, 11:14:58 AM9/15/22
to j2objc-...@googlegroups.com
No plans at all, nor will there be. Google's biggest apps are built with cross-platform Java for Android, iOS, and web (we have apps for Windows and MacOS, but those specific code bases for each platform). Android "just works" (as in, the cross-platform code doesn't use JRE API that Android doesn't support), J2ObjC is used for iOS, and J2CL for web. We aren't investigating other platforms.

But that doesn't mean someone can't take J2ObjC's source and radically modify it to support other platforms, as that's what the J2CL team did (and why we chose the Apache 2 license). All the hard bits of Java compiling (parsing, type checking, symbol attributing) is done by j2objc invoking javac for its AST, that's easily shared with similar tools. Next, the AST is mutated in several passes to make it more Objective-C/iOS specific, and finally, the AST is "printed" to generate the output. It's straightforward for any Java engineer to modify the AST and generate source files for another language: start with generating a hello-world snippet, then keep expanding what code the new tool can accept. 

For Windows, C# is similar enough to Java (more so than Objective-C or Closure) that an engineer should make quick progress with it. And don't assume only a Java expert can work on a tool like this, as we've had many interns over the years make significant contributions to our project, even though they had no previous compiler experience or education.

--
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.
Reply all
Reply to author
Forward
0 new messages