Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [HELP] Library help  (Read 1726 times)
0 Members and 1 Guest are viewing this topic.
Offline Renoria

Junior Member




...


« Posted 2009-02-12 07:26:46 »

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.
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #1 - Posted 2009-02-12 07:47:16 »

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.
Offline Renoria

Junior Member




...


« Reply #2 - Posted 2009-02-12 08:13:09 »

Thats not the point. The point is to try and.. hmm.. see if the libraries exist. So far I can't get it to work because it gives a main class not found error when I don't have the libraries.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Tunedbeats

Junior Newbie





« Reply #3 - Posted 2009-02-12 09:44:07 »

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.

Offline gouessej
« Reply #4 - Posted 2009-02-13 07:39:45 »

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.

Offline Renoria

Junior Member




...


« Reply #5 - Posted 2009-02-17 07:41:31 »

the program doesn't even launch, so using try/catch is out of the question.  Roll Eyes
Offline i30817

Junior Member





« Reply #6 - Posted 2009-02-18 02:17:25 »

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.

http://wiki.netbeans.org/DeclarativeRegistrationUsingAnnotations

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

Edit: I AM misunderstanding you.
Offline cylab

JGO Ninja


Medals: 38



« Reply #7 - Posted 2009-02-18 02:37:04 »

@Renoira
Please 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.

Mathias - I Know What [you] Did Last Summer!
Offline i30817

Junior Member





« Reply #8 - Posted 2009-02-18 03:35:04 »

He is probably talking about the local aplication lib folder that netbeans creates when it builds something that needs libraries.

Frankly, it's a cry of sanity in a eclipse devastated slum.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!