Jump to content
  • 0

[Request] I Need Help With a Little Code (do not already exist)


Question

Posted

I need a code to search the C3P0 library if there is any line then the server starts. for example:

this "code" there is only an explanation!

 

if getfrom c3p0 library example c3p0.com.mchange.util.AssertException

(

    line maxcheater don't exist

)

return;

 

if getform c3p0 library c3p0.com.mchange.util.AssertException

(

   lineage 2 maxcheaters

)

continue;

 

for start GS

 

anyway tx for read

3 answers to this question

Recommended Posts

  • 0
Posted

First of all: GS wont start if C3P0 does not exist (will throw an error and will

end abnormally)

 

didnt understood the question clarify, but here we go:

 

check if the library exists:

 

try
{
File mainjar = new File("l2jserver.jar");
String libpath = mainjar.getAbsolutePath().split("gameserver")[0];
File c3p0 = new File(libpath + "lib/c3p0jarname.jar");
return c3p0.exists();
}
catch(Exception e)
{ }
return false;

 

check if any class inside c3p0 exists:

 

try
{	
Class<?> func = Class.forName("package.path.here");
Object obj = func.newInstance();
return obj != null;
}
catch(ClassNotFoundException cnfe)
{ 
}
return false;

Guest
This topic is now closed to further replies.


×
×
  • Create New...