• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

importing local java package

 
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't normally use anything but the standard packages supplied by java. I now want to use an package for connecting to Steam called steamworks4j.jar
I have the file in my local directory and am trying to import it but get the following error.


I tend to get into these situations and then start trying random variations until one works. Sadly I haven't been very lucky today.
Any suggestions?

Mike
 
Saloon Keeper
Posts: 9831
80
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd have to check what steamworks is called inside the jar file. You can do that by running:
jar -tvf steamworks4j-1.7.0.jar
 
Mich Robinson
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the output:

Sorry, it's a bit long.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or you could go to the github page.
From the source file for that class the package is:
com.codedisaster.steamworks
 
Mich Robinson
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, already been through those pages. My question is really simple. How do I import the jar package so it will compile. I don't use other folks packages much and I don't use an environment that does all this for me. I assume I store the the jar file locally and then reference it via an import statement. I've tried just about every combo I could think of but haven't hit upon the right answer yet. Any suggestions?

 
Dave Tolls
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An import statement is either for all classes in a package (import com.codedisaster.steamworks.*;) or for a single class in a package (import com.codedisaster.steamworks.SteamAPI;).
In other words it's for importing classes, not packages.
 
Marshal
Posts: 77168
370
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has that sorted out your problem? Do you need the quote marks in the CLASSPATH (-cp) or will it work without?
 
Mich Robinson
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sort of. The program now compiles with the new jar file which is great but raises an error when calling the new stuff. I don't have a lot of luck when working with libraries which is why I tend not to use them. I think my code is doing the right thing. 'm using a publicly available AppId of 480 just to try and connect to the Steam. It's a baby first step of connecting and disconnecting but I'm getting an error. I have the jar file in the same directory and use code like the following:

But when I compile and run I get the following:
Looking up on the web this seems to indicate an unsatisfied native link error. My mind went a bit blank at this point. Am I missing something with how I'm importing stuff?

Mike
 
Campbell Ritchie
Marshal
Posts: 77168
370
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not certain, but you are probably importing everything correctly; otherwise you'd never get it to compile or run. Unsatisfied link errors usually mean there is a .dll or similar, or more precisely there isn't, because it is missing. Such an exception would only be thrown after the JVM has started. The first line of the error message tells you which method is missing: the (I) bit means it takes an int as its parameter and the Z bit means it returns a boolean (I think).
Does it say anything about .dll dependencies on the steam website? You may have to bite the bullet and install the library.
 
Mich Robinson
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suppose that does make sense. I guess the jar file provides an interface to the native library but doesn't actually supply the native library. I'll try and work out how to load that up now.

I'll admit I'm not very comfortable when I'm using other folks code. Even if they're much better coders than me. Hey ho.
 
Dave Tolls
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the documentation , in the Getting Started section, it sort of explains what is needed.

This bit (though unclear) seems to be the root:
"
By default, SteamAPI.init() detects the operating system it runs on, then extracts the appropriate native libraries from your application’s resource path to a temporary folder.
"

All of this seems to be based around this being for an app you are producing for Steam.
 
Mich Robinson
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I managed to get in touch with the developer and it simply turns out the init had to be called before the restartAppIfNecessary call. This sounds obvious but was a bit confusing in the docs (at least to me). It's all connecting quite well now! I guess I have to be a little patient and wait for my AppId to be issued before getting any further but I'm quite pleased with progress so far.
 
Mich Robinson
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... and I should of said that the above calls do load the native calls etc so I didn't have to do anything there.
 
Campbell Ritchie
Marshal
Posts: 77168
370
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done contacting them and getting the answer That merits a cow.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic