Ok, In my game at the moment, if you don't have the libraries under /lib it will give a main class not found error. How do I fix this, so like if they don't have the libraries it will try to download it for them? Or at least exit if it doesn't find the libraries? Right now the JVM isn't even launched if the libraries are not found so I have no clue.

do you not have the JDK? or is it a library like LWJGL. It doesnt matter really I guess. You jsut have to point the IDE to the file. Lilke with BlueJ it makes you find the JDK before you can start coding. And jsut make a new library for the others.

I suppose you could go for a try / catch ClassNotFoundException in the main method solution. Then exit the program in the catch block with a nice message.

However, if you are distributing your game in for example a JAR file, or online in a webstart, you (the programmer / distributor) should be responsible of supplying all required libraries, since the user can't download the libraries himself and "rebuild" the jar file.

Ok, In my game at the moment, if you don't have the libraries under /lib it will give a main class not found error. How do I fix this, so like if they don't have the libraries it will try to download it for them? Or at least exit if it doesn't find the libraries? Right now the JVM isn't even launched if the libraries are not found so I have no clue.

Do you plan to use Java Webstart? In my game, when a user launches it, if he has no JOGL library, it downloads it automatically.

Unless i am misunderstanding you, you want certain code paths to be active at runtime if a jar is in lib right? This can be achieved by having a interface to the implementation in your main program and the implementation in another jar, (if your lib doesn't require arguments to instantiate the class) using the ServiceLoader class and a special file in the implementation jar root. But ServiceLoader only became public with jdk 1.6 so i'd counsel using netbeans lookup that is an external lib. Also the new netbeans will have a cool annotation that will obviate the need to create the Meta inf file by hand... but last time i tried it didn't work yet.

If its possible, you might also want to register a null object as the default so your code doesn't have to care if the plugin is installed or not (Though null object has its problems too, imagine a user interface using it).

@RenoiraPlease specify, what "lib" folder you mean. If you consider the JDK lib directory to be a global place where java libraries are installed, you got something wrong. NEVER put any libraries in the JDK or other system directories unless you OBSOLUTELY know what you are doing.

Usually you distribute all the needed libraries with your game and specify the location where to look for them either via the java commandline argument -cp or by listing them in the manifest of your executable jar. Another option is to use webstart and list the dependencies in the jnlp file.

Please describe in more detail what you want to achieve and what the current problem is.

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