public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Help, Setting classpath, using external java libraries with Kawa
@ 2017-04-01  9:35 Vasantha Ganesh
  2017-04-01 11:23 ` Sudarshan S Chawathe
  2017-04-01 12:54 ` Per Bothner
  0 siblings, 2 replies; 6+ messages in thread
From: Vasantha Ganesh @ 2017-04-01  9:35 UTC (permalink / raw)
  To: kawa

Hello Bothner,
  This is probably a noob question. In Java while compiling and using
external libraries  we use -classpath option. How to use external java
libraries with Kawa?

I read https://www.gnu.org/software/kawa/Compiling.html

Then I tried to compile scheme program with `--main` and `-C` options
and generated a .class file. Then I tried to  run it with Java like a
normal class file by setting -classpath option, but I get:

Error: Could not find or load main class somescript

I also tried the -J option with kawa and I get

Error: Could not find or load main class

I also tried to set the CLASSPATH to the external library (jar file),
it does not work.

Vasantha Ganesh K.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help, Setting classpath, using external java libraries with Kawa
  2017-04-01  9:35 Help, Setting classpath, using external java libraries with Kawa Vasantha Ganesh
@ 2017-04-01 11:23 ` Sudarshan S Chawathe
  2017-04-01 12:54 ` Per Bothner
  1 sibling, 0 replies; 6+ messages in thread
From: Sudarshan S Chawathe @ 2017-04-01 11:23 UTC (permalink / raw)
  To: Vasantha Ganesh; +Cc: kawa

> From: Vasantha Ganesh <vasanthaganesh.k@gmail.com>
> Date: Sat, 1 Apr 2017 15:05:52 +0530

>   This is probably a noob question. In Java while compiling and using
> external libraries  we use -classpath option. How to use external java
> libraries with Kawa?

If I understand your question correctly then it seems you need to use
the -D option to define java.library.path suitably.  Example:

  kawa -Djava.library.path="/where/the/java/libs/are:/another/one:/so/on"

Regards,

-chaw

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help, Setting classpath, using external java libraries with Kawa
  2017-04-01  9:35 Help, Setting classpath, using external java libraries with Kawa Vasantha Ganesh
  2017-04-01 11:23 ` Sudarshan S Chawathe
@ 2017-04-01 12:54 ` Per Bothner
  2017-04-01 13:11   ` Vasantha Ganesh
  1 sibling, 1 reply; 6+ messages in thread
From: Per Bothner @ 2017-04-01 12:54 UTC (permalink / raw)
  To: Vasantha Ganesh, kawa

On 04/01/2017 02:35 AM, Vasantha Ganesh wrote:
> Hello Bothner,
>   This is probably a noob question. In Java while compiling and using
> external libraries  we use -classpath option. How to use external java
> libraries with Kawa?
>
> I read https://www.gnu.org/software/kawa/Compiling.html
>
> Then I tried to compile scheme program with `--main` and `-C` options
> and generated a .class file. Then I tried to  run it with Java like a
> normal class file by setting -classpath option, but I get:
>
> Error: Could not find or load main class somescript
>
> I also tried the -J option with kawa and I get
>
> Error: Could not find or load main class
>
> I also tried to set the CLASSPATH to the external library (jar file),
> it does not work.

Show us the actual commands you're trying, including the command used
to create the jar file.

Both setting CLASSPATH and using -J should work.

Note you have to use a separate -J option for each "word":

kawa -J-cp -Jfoo.jar

is roughly equivalent to

java -cp foo.jar kawa.repl

On 04/01/2017 04:23 AM, Sudarshan S Chawathe wrote:>> From: Vasantha Ganesh <vasanthaganesh.k@gmail.com>

> If I understand your question correctly then it seems you need to use
> the -D option to define java.library.path suitably.  Example:
>
>   kawa -Djava.library.path="/where/the/java/libs/are:/another/one:/so/on"

The java.library.path relates to native libraries (.so/.dll, not .class or .jar files).
It don't think it is relevant here.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help, Setting classpath, using external java libraries with Kawa
  2017-04-01 12:54 ` Per Bothner
@ 2017-04-01 13:11   ` Vasantha Ganesh
  2017-04-01 13:16     ` Vasantha Ganesh
  2017-04-01 13:17     ` Per Bothner
  0 siblings, 2 replies; 6+ messages in thread
From: Vasantha Ganesh @ 2017-04-01 13:11 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa

Hello,
  I'm trying to convert this(http://lpaste.net/354170) Java code into
Scheme(Kawa) (http://lpaste.net/354171).

I ran this for java and it ran without hickups,

java -cp /usr/share/java/jnr-ffi.jar:.:/usr/lib/java/jffi.jar:/usr/lib/java/jffi-native.jar:/usr/share/java/objectweb-asm/asm.jar
Getpid.java

and for kawa, I ran this:

kawa -J -cp /usr/share/java/jnr-ffi.jar:.:/usr/lib/java/jffi.jar:/usr/lib/java/jffi-native.jar:/usr/share/java/objectweb-asm/asm.jar
getpid.scm

The exact error that I get is:

Error: Could not find or load main class

Thank you,

Vasantha Ganesh K.

On Sat, Apr 1, 2017 at 6:24 PM, Per Bothner <per@bothner.com> wrote:
> On 04/01/2017 02:35 AM, Vasantha Ganesh wrote:
>>
>> Hello Bothner,
>>   This is probably a noob question. In Java while compiling and using
>> external libraries  we use -classpath option. How to use external java
>> libraries with Kawa?
>>
>> I read https://www.gnu.org/software/kawa/Compiling.html
>>
>> Then I tried to compile scheme program with `--main` and `-C` options
>> and generated a .class file. Then I tried to  run it with Java like a
>> normal class file by setting -classpath option, but I get:
>>
>> Error: Could not find or load main class somescript
>>
>> I also tried the -J option with kawa and I get
>>
>> Error: Could not find or load main class
>>
>> I also tried to set the CLASSPATH to the external library (jar file),
>> it does not work.
>
>
> Show us the actual commands you're trying, including the command used
> to create the jar file.
>
> Both setting CLASSPATH and using -J should work.
>
> Note you have to use a separate -J option for each "word":
>
> kawa -J-cp -Jfoo.jar
>
> is roughly equivalent to
>
> java -cp foo.jar kawa.repl
>
> On 04/01/2017 04:23 AM, Sudarshan S Chawathe wrote:>> From: Vasantha Ganesh
> <vasanthaganesh.k@gmail.com>
>
>> If I understand your question correctly then it seems you need to use
>> the -D option to define java.library.path suitably.  Example:
>>
>>   kawa -Djava.library.path="/where/the/java/libs/are:/another/one:/so/on"
>
>
> The java.library.path relates to native libraries (.so/.dll, not .class or
> .jar files).
> It don't think it is relevant here.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help, Setting classpath, using external java libraries with Kawa
  2017-04-01 13:11   ` Vasantha Ganesh
@ 2017-04-01 13:16     ` Vasantha Ganesh
  2017-04-01 13:17     ` Per Bothner
  1 sibling, 0 replies; 6+ messages in thread
From: Vasantha Ganesh @ 2017-04-01 13:16 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa

for java it was actually:

java -cp /usr/share/java/jnr-ffi.jar:.:/usr/lib/java/jffi.jar:/usr/lib/java/jffi-native.jar:/usr/share/java/objectweb-asm/asm.jar
Getpid

Vasantha Ganesh K.

On Sat, Apr 1, 2017 at 6:41 PM, Vasantha Ganesh
<vasanthaganesh.k@gmail.com> wrote:
> Hello,
>   I'm trying to convert this(http://lpaste.net/354170) Java code into
> Scheme(Kawa) (http://lpaste.net/354171).
>
> I ran this for java and it ran without hickups,
>
> java -cp /usr/share/java/jnr-ffi.jar:.:/usr/lib/java/jffi.jar:/usr/lib/java/jffi-native.jar:/usr/share/java/objectweb-asm/asm.jar
> Getpid.java
>
> and for kawa, I ran this:
>
> kawa -J -cp /usr/share/java/jnr-ffi.jar:.:/usr/lib/java/jffi.jar:/usr/lib/java/jffi-native.jar:/usr/share/java/objectweb-asm/asm.jar
> getpid.scm
>
> The exact error that I get is:
>
> Error: Could not find or load main class
>
> Thank you,
>
> Vasantha Ganesh K.
>
> On Sat, Apr 1, 2017 at 6:24 PM, Per Bothner <per@bothner.com> wrote:
>> On 04/01/2017 02:35 AM, Vasantha Ganesh wrote:
>>>
>>> Hello Bothner,
>>>   This is probably a noob question. In Java while compiling and using
>>> external libraries  we use -classpath option. How to use external java
>>> libraries with Kawa?
>>>
>>> I read https://www.gnu.org/software/kawa/Compiling.html
>>>
>>> Then I tried to compile scheme program with `--main` and `-C` options
>>> and generated a .class file. Then I tried to  run it with Java like a
>>> normal class file by setting -classpath option, but I get:
>>>
>>> Error: Could not find or load main class somescript
>>>
>>> I also tried the -J option with kawa and I get
>>>
>>> Error: Could not find or load main class
>>>
>>> I also tried to set the CLASSPATH to the external library (jar file),
>>> it does not work.
>>
>>
>> Show us the actual commands you're trying, including the command used
>> to create the jar file.
>>
>> Both setting CLASSPATH and using -J should work.
>>
>> Note you have to use a separate -J option for each "word":
>>
>> kawa -J-cp -Jfoo.jar
>>
>> is roughly equivalent to
>>
>> java -cp foo.jar kawa.repl
>>
>> On 04/01/2017 04:23 AM, Sudarshan S Chawathe wrote:>> From: Vasantha Ganesh
>> <vasanthaganesh.k@gmail.com>
>>
>>> If I understand your question correctly then it seems you need to use
>>> the -D option to define java.library.path suitably.  Example:
>>>
>>>   kawa -Djava.library.path="/where/the/java/libs/are:/another/one:/so/on"
>>
>>
>> The java.library.path relates to native libraries (.so/.dll, not .class or
>> .jar files).
>> It don't think it is relevant here.
>> --
>>         --Per Bothner
>> per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help, Setting classpath, using external java libraries with Kawa
  2017-04-01 13:11   ` Vasantha Ganesh
  2017-04-01 13:16     ` Vasantha Ganesh
@ 2017-04-01 13:17     ` Per Bothner
  1 sibling, 0 replies; 6+ messages in thread
From: Per Bothner @ 2017-04-01 13:17 UTC (permalink / raw)
  To: Vasantha Ganesh; +Cc: kawa

On 04/01/2017 06:11 AM, Vasantha Ganesh wrote:
> Hello,
>   I'm trying to convert this(http://lpaste.net/354170) Java code into
> Scheme(Kawa) (http://lpaste.net/354171).
>
> I ran this for java and it ran without hickups,
>
> java -cp /usr/share/java/jnr-ffi.jar:.:/usr/lib/java/jffi.jar:/usr/lib/java/jffi-native.jar:/usr/share/java/objectweb-asm/asm.jar
> Getpid.java
>
> and for kawa, I ran this:
>
> kawa -J -cp /usr/share/java/jnr-ffi.jar:.:/usr/lib/java/jffi.jar:/usr/lib/java/jffi-native.jar:/usr/share/java/objectweb-asm/asm.jar
> getpid.scm
>
> The exact error that I get is:
>
> Error: Could not find or load main class

There can't be any space after -J - it has to be the same option.
And as I wrote: you have to repeat the -J for each Java option:

kawa -J-cp -J/usr/share/java/jnr-ffi,jar:etc:etc getpid.scm

The -J option works the same way as in javac when it uses -J to pass
options to the JVM it is running on.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-01 13:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01  9:35 Help, Setting classpath, using external java libraries with Kawa Vasantha Ganesh
2017-04-01 11:23 ` Sudarshan S Chawathe
2017-04-01 12:54 ` Per Bothner
2017-04-01 13:11   ` Vasantha Ganesh
2017-04-01 13:16     ` Vasantha Ganesh
2017-04-01 13:17     ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).