Hello Mikio and David,

In following, I wrote the 2 sample classes that let compiler fail to compile.

-------------------------------------------------
public class Main {

    public static def main(Rail[String]) {
      JsonTest.createJson();
    }
}
-------------------------------------------------
import com.google.gson.Gson;
class JsonTest {

    public static def createJson() {

        val json = new Gson();
    }
}
--------------------------------------------------

The error output of compilation by -v -classpath gson-2.2.4.jar Main.x10 is following.
--------------------------------------------------------------------------------------------------------------------------------------------------
seisei@seisei:~/x10compiler2.4.2/x10.dist/bin/src> ../x10c -v -classpath gson-2.2.4.jar Main.x10 "/opt/jdk1.7.0_51/bin/java" -Xmx1024m -Dfile.encoding=UTF-8 -Dx10.dist="/home/seisei/x10compiler2.4.2/x10.dist" -classpath "/home/seisei/x10compiler2.4.2/x10.dist/lib/x10c.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/lpg.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/com.ibm.wala.cast.java_1.0.0.201101071300.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/com.ibm.wala.cast_1.0.0.201101071300.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/com.ibm.wala.core_1.1.3.201101071300.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/com.ibm.wala.shrike_1.3.1.201101071300.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/x10wala.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/org.eclipse.equinox.common_3.6.0.v20100503.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/commons-math3-3.2.jar:/home/seisei/x10compiler2.4.2/x10.dist/lib/commons-logging-1.1.3.jar" polyglot.main.Main -extclass x10c.ExtensionInfo -define __JAVA__ -x10lib /home/seisei/x10compiler2.4.2/x10.dist/stdlib/libx10.properties 'Main.x10' -classpath "gson-2.2.4.jar" /home/seisei/x10compiler2.4.2/x10.dist/bin/src/JsonTest.x10:7: Could not find type "Gson". /home/seisei/x10compiler2.4.2/x10.dist/bin/src/JsonTest.x10:7: No valid constructor found for Gson().
2 errors.
---------------------------------------------------------------------------------------------------------------------------------------------------

I found 2 ways to solve this error. The compilation can be succeeded by doing one of the following 2 ways.
  1. In JsonTest.x10, rewrote "new Gson()" to "new com.google.gson.Gson()"
Though there is a statement of "import com.google.gson.Gson;", why Free Qualified Class Name is needed when creating an instance?
  2. In Main.x10, add "import com.google.gson.Gson;"
In Main.x10, there aren't statements of using Gson, so I don't know why this way can fix the error.


The University of Tokyo,
Seisei Itahashi



(2014?05?14? 09:53), Mikio Takeuchi wrote:
Hi Seisei,

If you were still troubled with this problem, make sure you invoke x10c command with -v as well and send the whole output including errors you mentioned to this list.

Thanks,

-- Mikio

On May 14, 2014, at 4:26, David P Grove <gro...@us.ibm.com <mailto:gro...@us.ibm.com>> wrote:

Seisei Itahashi <sei...@csg.ci.i.u-tokyo.ac.jp <mailto:sei...@csg.ci.i.u-tokyo.ac.jp>> wrote on 05/13/2014 02:00:57 PM:
>
> In managed X10, I want to compile x10 files with jar file. In X10DT,
> I succeeded
> in using jar file by clicking the menu "add external archives". However,
> on the terminal, the following way failed to compile.
> "x10c -classpath gson-2.2.4.jar JsonTest.x10"
>
> So, how can I compile with jar file on terminal?
>

Hi,

It should work with x10c -classpath <somejar.jar>

I threw together a quick test of x10/java interop and adding the Java .jar file to the x10c commandline via -classpath worked for me.

--dave

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net <mailto:X10-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/x10-users


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs


_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to