public static String getWorkingDirectoryFromJar( String resource )
	{
		String s;
		// if jarloc property is set, use it to find working directory
		if( System.getProperty( "org.openxls.extenxls.jarloc" ) != null )
		{
			s = System.getProperty( "org.openxls.extenxls.jarloc" ) + "!";
		}
		else
		{
			URL u = ResourceLoader.class.getResource( resource );
			s = u.getFile();
		}
			log.debug( "Resource: " + resource + " found in: " + s );

		// cut off the internal zip file part & the file:/
		int begin = -1;
		begin = s.indexOf( "file:" );
		if( begin < 0 )
		{
			begin = s.indexOf( ":" );
			begin += 1;
		}
		else
		{
			begin += 5;
		}
		s = s.substring( begin );
		if( s.indexOf( ":" ) != -1 )
		{ //windoze box
			if( s.indexOf( "/" ) == 0 )
			{
				s = s.substring( 1 );
			}
		}
			log.debug( "ResourceLoader() after stripping:" + s );
		int i = s.indexOf( "!" );
		if( i > -1 )
		{
			String zipstring = s.substring( 0, i );
			i = zipstring.lastIndexOf( "/" );
			if( i == -1 )
			{
				i = zipstring.lastIndexOf( "\\" );
			}
			zipstring = zipstring.substring( 0, i );
				log.debug( "ResourceLoader() returning zipstring Final Working Directory Setting: " + zipstring );
			return zipstring;
		}
			log.debug( "ResourceLoader() returning Final Working Directory Setting: " + s );
		return s;
	}