LuaJava - A Script Tool

Can't get to work

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 3690 Views - Last Post: 19 October 2009 - 01:22 PM Rate Topic: -----

#1 bmcginnis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 130
  • Joined: 21-February 09

LuaJava - A Script Tool

Posted 18 October 2009 - 09:54 PM

I've been working on sort of random programs to work with World of Warcraft. Recently I came across LuaJava (http://www.keplerproject.org/luajava) which allows lua and java to work together. I installed it how it said to on the home site and tried some basic API to test if it was working correctly. I tried the following:

public class Dinger
{
	public static void main(String[] args) throws AWTException
	{
		LuaState L = LuaStateFactory.newLuaState();
	
	}
}



But i receive the following error:

Dinger.java:13: cannot find symbol
symbol : class LuaState
location: class Dinger
LuaState L = LuaStateFactory.newLuaState();
^

This is the first time i tried to install a 3rd party script thing or what ever you would call it. The benefits of getting this working would be amazing for my programs since WoW uses LUA I would have added interactivity. Please help if u know how to install luajava or something similar.

Is This A Good Question/Topic? 0
  • +

Replies To: LuaJava - A Script Tool

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10823
  • View blog
  • Posts: 40,354
  • Joined: 27-December 08

Re: LuaJava - A Script Tool

Posted 18 October 2009 - 10:23 PM

You need to import LuaState. So above your class definition:
import path.LuaState; 



If there are multiple subdirectories, specify each one separated by commas periods (sorry, typo). For example, if you have Folder A containing Folder B containing LuaState, your import looks like this:
import A.B.LuaState;


This post has been edited by macosxnerd101: 19 October 2009 - 05:07 AM

Was This Post Helpful? 0
  • +
  • -

#3 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: LuaJava - A Script Tool

Posted 18 October 2009 - 11:37 PM

View Postmacosxnerd101, on 18 Oct, 2009 - 11:23 PM, said:

If there are multiple subdirectories, specify each one separated by commas. For example, if you have Folder A containing Folder B containing LuaState, your import looks like this:


Periods. ;)
Was This Post Helpful? 0
  • +
  • -

#4 bmcginnis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 130
  • Joined: 21-February 09

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 03:29 AM

Still cant get it to work, if luajava-1.1.dll is located directly in the jre bin folder, shouldn't it just be import java.LuaJava;? That doesnt work for me.
Was This Post Helpful? 0
  • +
  • -

#5 bmcginnis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 130
  • Joined: 21-February 09

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 07:52 AM

bump
Was This Post Helpful? 0
  • +
  • -

#6 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 07:59 AM

Uhhh...call me crazy, but Java doesn't use DLLs.

Uhh...yeah.

This post has been edited by Locke: 19 October 2009 - 09:36 AM

Was This Post Helpful? 0
  • +
  • -

#7 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3124
  • View blog
  • Posts: 19,168
  • Joined: 14-September 07

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:27 AM

First bumping is bad form.

Second, this library has poor installation documentation. In order to get it to compile, I had to add the .jar as an external library to my project:

import org.keplerproject.luajava.LuaState;
import org.keplerproject.luajava.LuaStateFactory;

public class LuaJavaTest {

	 public static void main(String[] args){
		LuaState L = LuaStateFactory.newLuaState();
		System.out.println("Checking classpath...");
	}
}



View PostLocke, on 19 Oct, 2009 - 07:59 AM, said:

If you want proof, just look at how many other DLLs there are in your JRE folder.



There's a shit load of dlls in the jre folder ;)


to run it, i had to put the dll in my system folder. Java wouldn't find it in my jre/bin folder for some weird reason. :angry:

This post has been edited by KYA: 19 October 2009 - 08:30 AM

Was This Post Helpful? 0
  • +
  • -

#8 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5943
  • View blog
  • Posts: 12,871
  • Joined: 16-October 07

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:30 AM

View PostLocke, on 19 Oct, 2009 - 08:59 AM, said:

Uhhh...call me crazy, but Java doesn't use DLLs.


You're crazy. ;) You're also right.

The DLL would be for going to Lua to Java. There is also a JAR to go from Java to Lua.

Include the JAR (luajava-1.1.jar?) in your Java classpath. That is almost certainly your problem.
Was This Post Helpful? 0
  • +
  • -

#9 bmcginnis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 130
  • Joined: 21-February 09

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:33 AM

Thanks for the

import org.keplerproject.luajava.LuaState;
import org.keplerproject.luajava.LuaStateFactory;

I had a feeling I wasn't importing it correctly. However, I still can't get it to work. luajava-1.1.jar is in the same folder as my program and luajava-1.1.dll is in both my JRE and system folder.

I noticed on the luajava site that it says the dependencies are LuaBinaries 5.1.1 and JDK 1.4 or above. I'm good on the JDK but was wondering if this maybe isn't working because I installed the LUA executable for windows, not the binaries. Just a thought, could that possible be it or does the executable include the binaries?

This post has been edited by bmcginnis: 19 October 2009 - 08:45 AM

Was This Post Helpful? 0
  • +
  • -

#10 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3124
  • View blog
  • Posts: 19,168
  • Joined: 14-September 07

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:48 AM

By executable do you mean you used the prepackaged installer of lua for windows? If yes, then you should be good to go, as that's what I used.
Was This Post Helpful? 0
  • +
  • -

#11 bmcginnis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 130
  • Joined: 21-February 09

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:50 AM

yeah thats what I used, not sure why it wont work

Dinger.java:1: package org.keplerproject.luajava does not exist
import org.keplerproject.luajava.*;
Was This Post Helpful? 0
  • +
  • -

#12 syfran  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 83
  • View blog
  • Posts: 1,103
  • Joined: 12-July 09

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:56 AM

classpath problem?
Was This Post Helpful? 0
  • +
  • -

#13 Dophert  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 60
  • Joined: 19-October 09

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:57 AM

Try loading it into a genuine IDE such as Eclipse or Netbeans, add your library correctly and see if it gives you any options to fix it.

EDIT: Just noticed: Following conventions, locals should be declared starting with a lowercase :).

This post has been edited by Dophert: 19 October 2009 - 08:58 AM

Was This Post Helpful? 0
  • +
  • -

#14 bmcginnis  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 130
  • Joined: 21-February 09

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 08:57 AM

problem fixed, i missed where u said to add the .jar as an external library. thanks for the help everyone.
Was This Post Helpful? 0
  • +
  • -

#15 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: LuaJava - A Script Tool

Posted 19 October 2009 - 09:36 AM

View PostKYA, on 19 Oct, 2009 - 09:27 AM, said:

View PostLocke, on 19 Oct, 2009 - 07:59 AM, said:

If you want proof, just look at how many other DLLs there are in your JRE folder.


There's a shit load of dlls in the jre folder ;)


Oh. Yeah. Uhm. Ermm.......

I was in the JDK folder. God, sometimes I think I'm in the wrong field. :(
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2