Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (773)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  LuaJ and LibGDX - Class not found  (Read 1336 times)
0 Members and 1 Guest are viewing this topic.
Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Posted 2015-03-31 13:53:16 »

So I decided to have a little look at lua scripting for fun, decided on LuaJ after some googling.

I am just using an existing code base for this, as you might have read in this thread here, I was looking for a way to handle component data outside of the java code. Like loading from JSON (this is my method at the moment) or XML.

So yeah, here is the problem.

This an Android game, that is where the problem lies as it works fine on desktop. It can find, load and run the script just fine.

Here is the script:

1  
2  
3  
4  
5  
6  
7  
function init(entity)   
   local package = "com.gibbo.components";
   local size = luajava.newInstance(package..".SizeComponent");
   size:setWidth(1.5f);
   size:setHeight(1.5f);
   entity:add(size);
end


The obvious problematic line is
local size = luajava.newInstance(package..".SizeComponent");
, which can not be found on Android. I am not sure what else I can say, besides that I have the error:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
03-31 14:51:16.038: I/ERROR(26785): Lua error 
03-31 14:51:16.038: I/ERROR(26785): function init(entity, position)  
03-31 14:51:16.038: I/ERROR(26785):    local package = "com.gibbo.components";
03-31 14:51:16.038: I/ERROR(26785):    local size = luajava.newInstance(package..".SizeComponent");
03-31 14:51:16.038: I/ERROR(26785):    size:setWidth(1.5f);
03-31 14:51:16.038: I/ERROR(26785):    size:setHeight(1.5f);
03-31 14:51:16.038: I/ERROR(26785):    entity:add(size);
03-31 14:51:16.038: I/ERROR(26785): end
03-31 14:51:16.038: I/ERROR(26785):
03-31 14:51:16.038: I/ERROR(26785): :4 vm error: java.lang.ClassNotFoundException: com.gibbo.components.SizeComponent


There is obviously some sort of difference about how android is compiled compared to desktop, but yeah, not sure what to do from here.

UPDATE:

I found this on stack overflow that states I can either downgrade to fix the problem, however I can not find any documentation for anything prior to LuaJ 3.0. So I decided to instead go with the second second suggestions, I downloaded the source and found the missing libaries and changed the source. But nada, still same problem.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1850 views)
2018-06-10 19:43:48

EgonOlsen (1879 views)
2018-06-10 19:43:44

EgonOlsen (1244 views)
2018-06-10 19:43:20

DesertCoockie (1679 views)
2018-05-13 18:23:11

nelsongames (1344 views)
2018-04-24 18:15:36

nelsongames (1962 views)
2018-04-24 18:14:32

ivj94 (2735 views)
2018-03-24 14:47:39

ivj94 (1937 views)
2018-03-24 14:46:31

ivj94 (3028 views)
2018-03-24 14:43:53

Solater (1077 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!