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.
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?
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.
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?
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.
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.
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.