How to convert java code to swift using j2objc

2,447 views
Skip to first unread message

kranti kumar

unread,
Feb 29, 2016, 5:38:24 AM2/29/16
to j2objc-discuss
I installed j2objc and executed java file result is objective c file but i want swift file,can anyone please reply

kranti kumar

unread,
Feb 29, 2016, 9:03:15 AM2/29/16
to j2objc-discuss
#include "IOSObjectArray.h" not found in xcode

Tom Ball

unread,
Feb 29, 2016, 1:46:19 PM2/29/16
to j2objc-discuss
j2objc translates Java to Objective C, not Swift. However, compiled j2objc translations are plain-old Objective C classes, which can be imported using a Swift bridging header

IOSObjectArray.h is in $WHEREVER_YOU_UNZIPPED_THE_J2OBJC_ZIP_FILE/include/. Add that path to your target's User Header Search Paths setting.

On Mon, Feb 29, 2016 at 6:03 AM kranti kumar <krant...@gmail.com> wrote:
#include "IOSObjectArray.h" not found in xcode

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

kranti kumar

unread,
Mar 1, 2016, 12:41:59 AM3/1/16
to j2objc-discuss

 hi, i resolved that include header path,after that i converted code to arc,right now i am getting this error,please reply

 "_IOSClass_fromClass", referenced from:

      ___Student_class__block_invoke in Student.o

  "_JavaLangSystem__initialized", referenced from:

      -[Student getName] in Student.o

  "_JavaLangSystem_out", referenced from:

      -[Student getName] in Student.o

  "_JreThrowNullPointerException", referenced from:

      -[Student getName] in Student.o

  "_OBJC_CLASS_$_JavaLangSystem", referenced from:

      objc-class-ref in Student.o

ld: symbol(s) not found for architecture x86_64 

Tom Ball

unread,
Mar 1, 2016, 12:44:55 AM3/1/16
to j2objc-discuss

kranti kumar

unread,
Mar 1, 2016, 12:52:31 AM3/1/16
to j2objc-discuss

hi, i read j2objc documentation,if i am doing with terminal commands i am getting output but if i copy the files in xcode,it is showing some errors,i am in resolving process ,currently i got this error please reply if you have any  idea related to this error

kranti kumar

unread,
Mar 1, 2016, 3:00:23 AM3/1/16
to j2objc-discuss

-fobjc-arc is not supported on platforms using the legacy runtime error is showing

Tom Ball

unread,
Mar 1, 2016, 9:48:09 AM3/1/16
to j2objc-...@googlegroups.com
The link errors are because you skipped the Update the Build Settings section; in particular, adding the "-ljre_emul" linker flag.

There is an example project, j2objc-sample-reversi, that demonstrates an Xcode project with Java sources. It requires the latest j2objc release.

--

khaled....@gmail.com

unread,
Mar 17, 2017, 7:50:35 AM3/17/17
to j2objc-discuss
On Monday, February 29, 2016 at 1:38:24 PM UTC+3, kranti kumar wrote:
> I installed j2objc and executed java file result is objective c file but i want swift file,can anyone please reply

//first class:
public class read_arabic extends Activity {
public static int path_chars=0;
public static int path_chars(){
return path_chars;
}

public void onCreate(Bundle savedInstanceState) {

b29.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
path_chars=7;
}
});

}
}
//-----------------------------------------------------------
//second class:
public class read_arabic2 extends Activity {
public void onCreate(Bundle savedInstanceState)
{
final read_arabic qq=new read_arabic();
b30.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
qq.path_chars=6;
}
});
}
}

Reply all
Reply to author
Forward
0 new messages