The exclusive promotional activities on JCOP J3H145 card and Feitian R301 Smartcard Reader are in full swing. Please check this page for details.

how to set project configuration

JCIDE related questions and answers.

Moderators: product, kuafu

a803904
Posts: 1
Joined: Fri Jun 29, 2018 10:57 am
Points :38
Contact:

how to set project configuration

Post by a803904 » Mon Jul 02, 2018 11:32 pm

JCIDE 2.0.6.2
where to set compile file encoding?
where to set jc.home property?

: Converter [v3.0.4]
03, 2018 11:30:59
: Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.


error: Java property "jc.home" is not set.
com.sun.javacard.converter.ConverterException
Cap file generation failed.

kuafu
Posts: 169
Joined: Thu Jun 25, 2015 2:09 am
Points :1861
Contact:

Re: how to set project configuration

Post by kuafu » Thu Jul 12, 2018 1:17 am

Hi all,
I found some bug on converter of the JCDK v3.0.4.
1. In some case (some class in package implements the Shareable interface, exp) , the ant task of converter throws error like this:
[convert] error: Java property "jc.home" is not set.
[convert] com.sun.javacard.converter.ConverterException
[convert]
[convert] Cap file generation failed.
But, when convert same package with the JCDK/bin/converter.bat directly, it's fine.
By watched the convert.bat file, and decompiled the jctask.jar, I got the bug.
According to convert.bat file: "%JAVA_HOME%\bin\java" -Djc.home=%JC_CLASSIC_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.converter.Main %*, we found there is a arg named jc.home is needed in com.sun.javacard.converter.Main. when this Class is forked in the ant task, this arg is missing.
Because converterTask is the subclass of JavaTask and extended the JavaTask's attributes, so can fixed the bug by add this attributes to task XML: <jvmarg value="-Djc.home=${env.JC_CLASSIC_HOME}"/>, but it's should still be treated as a bug.
2.When a Shareable interface is implements by other package, in the out-dir a same package and a same java and class file of the Interface is created . and this java file and class file may not same as original one, the fileds of Interface is deleted, only keep the methods. If we use the same SrcDir and DstDir, the package of the Shareable Interface 's class file will be replaced, and will failed in convert.
here is the my example xml file of ant in v3.0.4
<convert JCA="true" CAP="true" EXP="true" ClassDir="${JCAPI_BIN}" Outputdirectory="${JCAPI_CAP}" exportmap="true" debug="true" packagename="org.globalplatform" packageaid="0xA0:0x00:0x00:0x01:0x51:0x00" majorminorversion="1.0">
<jvmarg value="-Djc.home=${JC_HOME}"/>
<exportpath path="${JCAPI_EXP}" ></exportpath>
<classpath refid="CONVERTER_PATH" />
</convert>
it's very complex then v 2.2.2
<convert JCA="true" CAP="true" EXP="true" dir="${JCAPI_BIN}" exportmap="true" debug="true" packagename="org.globalplatform" packageaid="0xA0:0x00:0x00:0x01:0x51:0x00" majorminorversion="1.0">
<exportpath path="${JCAPI_EXP}" ></exportpath>
<classpath refid="CONVER_PATH" />
well

kuafu
Posts: 169
Joined: Thu Jun 25, 2015 2:09 am
Points :1861
Contact:

Re: how to set project configuration

Post by kuafu » Thu Jul 12, 2018 1:18 am

set compile file encoding
You do not have the required permissions to view the files attached to this post. Please login first.
well

kuafu
Posts: 169
Joined: Thu Jun 25, 2015 2:09 am
Points :1861
Contact:

Re: how to set project configuration

Post by kuafu » Thu Jul 12, 2018 4:37 am

a803904 wrote:JCIDE 2.0.6.2
where to set compile file encoding?
where to set jc.home property?

: Converter [v3.0.4]
03, 2018 11:30:59
: Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.


error: Java property "jc.home" is not set.
com.sun.javacard.converter.ConverterException
Cap file generation failed.


JCIDE need to add "-Djc.home=%JC_CLASSIC_HOME%" when compiler to fix the problem.
well

javacardstudy
Posts: 4
Joined: Thu Jul 26, 2018 5:55 am
Points :50
Contact:

Re: how to set project configuration

Post by javacardstudy » Thu Aug 09, 2018 4:52 am

kuafu wrote:
Thu Jul 12, 2018 4:37 am
a803904 wrote:JCIDE 2.0.6.2
where to set compile file encoding?
where to set jc.home property?

: Converter [v3.0.4]
03, 2018 11:30:59
: Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.


error: Java property "jc.home" is not set.
com.sun.javacard.converter.ConverterException
Cap file generation failed.
JCIDE need to add "-Djc.home=%JC_CLASSIC_HOME%" when compiler to fix the problem.
Hi.please Where to add this "-Djc.home=%JC_CLASSIC_HOME%" ,thanks.

kuafu
Posts: 169
Joined: Thu Jun 25, 2015 2:09 am
Points :1861
Contact:

Re: how to set project configuration

Post by kuafu » Sat Dec 15, 2018 8:49 pm

We use feitian's convertor 2.2.2 replace convetor 3.0.4, on jc kit 3.04 then it would not trouble you anymore.We test it for six months,it works find.
well

tay00000
Posts: 141
Joined: Tue Sep 27, 2016 10:58 am
Points :1876
Contact:

Re: how to set project configuration

Post by tay00000 » Tue Dec 18, 2018 1:27 am

Hi,

I am also stuck with 'error: Java property "jc.home" is not set.' error while creating an applet that uses Shareable interface.

I am currently running JC 3.0.4.

Do you have the steps to remedy the problem like how to replace Feitian's converter ?

tay00000
Posts: 141
Joined: Tue Sep 27, 2016 10:58 am
Points :1876
Contact:

Re: how to set project configuration

Post by tay00000 » Wed Dec 19, 2018 5:09 am

Here's a workaround I figured out. You will need to build and clean the project as usual even if it continues issue the jc.home not set error. This will not affect the next steps as long as the compilation is clean without errors.

jc.home error is due to problems in JCIDE's packaging and can be corrected via manual command.

Go to your JCDK installation (I will use JCDK 3.0.4 installation as example).

Open command prompt and cd to JCDK directory (i.e. cd C:\JCDK3.0.4\bin)

Once you cd into the JCDK installation's bin directory, you will see a converter.bat batch file. You will now use this converter.bat batch file to proceed with packaging the CAP, JCA and EXP files from now on.

Modify the following command as you need for your project before issuing the converter.bat command:

Code: Select all

converter.bat -out EXP JCA CAP -i -debug -classdir C:\WORKSP~1\<Project directory>\bin -exportpath "C:\JavaCardKit\SDK\Tools\JCIDE\lib\JavaCos_kit\gp\gp211\export_files\gp_export_files";"C:\JavaCardKit\SDK\Tools\JCIDE\lib\JavaCos_kit\sm\2012\export_files\fmsh";"C:\JavaCardKit\SDK\Tools\JCIDE\lib\JavaCos_kit\sm\2012\export_files\sm_export_files";"C:\JavaCardKit\SDK\Tools\JCIDE\lib\JavaCos_kit\sm\2012\export_files\visa_export_files";"C:\JavaCardKit\SDK\Tools\JCIDE\lib\java_card_kit\3_0_4\export_files\api_export_files";"C:\workspace\<Project directory>\.JCIDE\unzip_temp";"C:\workspace\<Project directory>\bin"; -applet 0x30:0x30:0x30:0x30:0x30:0x00 <Project name>.<Applet main class> <Applet main class> 0x30:0x30:0x30:0x30:0x30 1.0
The above command assumes that the default installation of the JCIDE workspace is used with default JavaCardKit and other supporting packages.

Please change the Applet and Package IDs of

Code: Select all

 0x30:0x30:0x30:0x30:0x30
to your suitable AID and PID as well.

This has to be done manually in the command prompt until JavaCardOS or Feitian fixes the issue above.

kuafu
Posts: 169
Joined: Thu Jun 25, 2015 2:09 am
Points :1861
Contact:

Re: how to set project configuration

Post by kuafu » Wed Dec 19, 2018 5:15 am

tay00000 wrote:
Tue Dec 18, 2018 1:27 am
Hi,

I am also stuck with 'error: Java property "jc.home" is not set.' error while creating an applet that uses Shareable interface.

I am currently running JC 3.0.4.

Do you have the steps to remedy the problem like how to replace Feitian's converter ?
We had try to set jc.home while using JC 3.0.4 ,but it still has problem. But it works find on JC 3.0. 5. So I think that converter ofJC 3.0.4 maybe has problem. So we had to replace the convertor ,used older version of convertor.
well

tay00000
Posts: 141
Joined: Tue Sep 27, 2016 10:58 am
Points :1876
Contact:

Re: how to set project configuration

Post by tay00000 » Wed Dec 19, 2018 9:21 pm

kuafu wrote:
Wed Dec 19, 2018 5:15 am
We had try to set jc.home while using JC 3.0.4 ,but it still has problem. But it works find on JC 3.0. 5. So I think that converter ofJC 3.0.4 maybe has problem. So we had to replace the convertor ,used older version of convertor.
Yup that's where my second post above talks about how to mitigate the problem of JCIDE not building the packages properly.

Essentially the user would still need to press the Build and Clean projects button in JCIDE as usual and have to watch the output where the cleaning and compiling have to succeed and the packaging have to fail.

Once the packaging fail but the compile succeeds, run the converter.bat in the JCDK 3.0.4's /bin folder.

That way, JCDK 3.0.4 can still be used as the converter.bat already helps setting jc.home internally according to the batch file script.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 2 guests

JavaCard OS : Disclaimer