weimingtom / jnlua

Automatically exported from code.google.com/p/jnlua
0 stars 0 forks source link

Cannot "require" the classes in other jar files #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For the lua code below:
  javavm = require("javavm")
  javavm.create("-Djava.class.path=jnlua-0.9.6.jar;osql.jar")
  db = java.require("com.asql.core.DBConnection")

It will raise java.lang.ClassNotFoundException in 3rd line.
I've tried using URLClassLoader but it doesn't work. The available way is to 
copy all files in osql.jar into jnlua-0.9.6.jar.

The following examples would work fine, in this case, the DriverManger would 
indirectly refer to the drivers that defined in "ojdbc6.jar"
  javavm = require("javavm")
  javavm.create("-Djava.class.path=jnlua-1.0.2.jar;ojdbc6.jar")
  driver = java.require("java.sql.DriverManager")
  conn=driver:getConnection("jdbc:oracle:thin:@//localhost:1521/orcl","usr","pwd")

Original issue reported on code.google.com by hyee...@gmail.com on 24 Mar 2014 at 3:02